@codemieai/code 0.15.1 → 0.15.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.
Files changed (202) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/bin/codemie.js +52 -0
  3. package/dist/agents/core/AgentCLI.d.ts.map +1 -1
  4. package/dist/agents/core/AgentCLI.js +6 -0
  5. package/dist/agents/core/AgentCLI.js.map +1 -1
  6. package/dist/agents/core/BaseAgentAdapter.d.ts +25 -0
  7. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  8. package/dist/agents/core/BaseAgentAdapter.js +137 -127
  9. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  10. package/dist/agents/core/session/BaseProcessor.d.ts +10 -0
  11. package/dist/agents/core/session/BaseProcessor.d.ts.map +1 -1
  12. package/dist/agents/core/session/BaseProcessor.js +11 -1
  13. package/dist/agents/core/session/BaseProcessor.js.map +1 -1
  14. package/dist/agents/core/session/BaseSessionAdapter.d.ts +4 -0
  15. package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
  16. package/dist/agents/core/types.d.ts +11 -5
  17. package/dist/agents/core/types.d.ts.map +1 -1
  18. package/dist/agents/plugins/claude/claude.models.d.ts.map +1 -1
  19. package/dist/agents/plugins/claude/claude.models.js +12 -11
  20. package/dist/agents/plugins/claude/claude.models.js.map +1 -1
  21. package/dist/agents/plugins/claude/claude.plugin.d.ts +3 -3
  22. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  23. package/dist/agents/plugins/claude/claude.plugin.js +14 -13
  24. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  25. package/dist/agents/plugins/claude/claude.session.d.ts.map +1 -1
  26. package/dist/agents/plugins/claude/claude.session.js +27 -1
  27. package/dist/agents/plugins/claude/claude.session.js.map +1 -1
  28. package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
  29. package/dist/agents/plugins/claude/plugin/hooks/hooks.json +7 -7
  30. package/dist/agents/plugins/codex/codex.plugin.d.ts.map +1 -1
  31. package/dist/agents/plugins/codex/codex.plugin.js +7 -6
  32. package/dist/agents/plugins/codex/codex.plugin.js.map +1 -1
  33. package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.d.ts.map +1 -1
  34. package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js +5 -2
  35. package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js.map +1 -1
  36. package/dist/agents/plugins/gemini/extension/gemini-extension.json +1 -1
  37. package/dist/agents/plugins/gemini/extension/hooks/hooks.json +7 -7
  38. package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
  39. package/dist/agents/plugins/gemini/gemini.plugin.js +7 -6
  40. package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
  41. package/dist/agents/plugins/kimi/kimi.hook-config-injector.d.ts.map +1 -1
  42. package/dist/agents/plugins/kimi/kimi.hook-config-injector.js +26 -5
  43. package/dist/agents/plugins/kimi/kimi.hook-config-injector.js.map +1 -1
  44. package/dist/agents/plugins/kimi/kimi.plugin.d.ts.map +1 -1
  45. package/dist/agents/plugins/kimi/kimi.plugin.js +5 -2
  46. package/dist/agents/plugins/kimi/kimi.plugin.js.map +1 -1
  47. package/dist/cli/commands/analytics/cost/claude-dispatch-allocation.d.ts +6 -0
  48. package/dist/cli/commands/analytics/cost/claude-dispatch-allocation.d.ts.map +1 -0
  49. package/dist/cli/commands/analytics/cost/claude-dispatch-allocation.js +115 -0
  50. package/dist/cli/commands/analytics/cost/claude-dispatch-allocation.js.map +1 -0
  51. package/dist/cli/commands/analytics/cost/claude-lifecycle.d.ts +6 -0
  52. package/dist/cli/commands/analytics/cost/claude-lifecycle.d.ts.map +1 -0
  53. package/dist/cli/commands/analytics/cost/claude-lifecycle.js +107 -0
  54. package/dist/cli/commands/analytics/cost/claude-lifecycle.js.map +1 -0
  55. package/dist/cli/commands/analytics/cost/claude-native.d.ts +54 -0
  56. package/dist/cli/commands/analytics/cost/claude-native.d.ts.map +1 -0
  57. package/dist/cli/commands/analytics/cost/claude-native.js +14 -0
  58. package/dist/cli/commands/analytics/cost/claude-native.js.map +1 -0
  59. package/dist/cli/commands/analytics/cost/claude-ownership.d.ts +23 -0
  60. package/dist/cli/commands/analytics/cost/claude-ownership.d.ts.map +1 -0
  61. package/dist/cli/commands/analytics/cost/claude-ownership.js +99 -0
  62. package/dist/cli/commands/analytics/cost/claude-ownership.js.map +1 -0
  63. package/dist/cli/commands/analytics/cost/claude-trace.d.ts +28 -0
  64. package/dist/cli/commands/analytics/cost/claude-trace.d.ts.map +1 -0
  65. package/dist/cli/commands/analytics/cost/claude-trace.js +120 -0
  66. package/dist/cli/commands/analytics/cost/claude-trace.js.map +1 -0
  67. package/dist/cli/commands/analytics/cost/cost-enricher.d.ts +1 -1
  68. package/dist/cli/commands/analytics/cost/cost-enricher.d.ts.map +1 -1
  69. package/dist/cli/commands/analytics/cost/cost-enricher.js +34 -43
  70. package/dist/cli/commands/analytics/cost/cost-enricher.js.map +1 -1
  71. package/dist/cli/commands/analytics/cost/dispatch-allocation.d.ts +18 -0
  72. package/dist/cli/commands/analytics/cost/dispatch-allocation.d.ts.map +1 -0
  73. package/dist/cli/commands/analytics/cost/dispatch-allocation.js +53 -0
  74. package/dist/cli/commands/analytics/cost/dispatch-allocation.js.map +1 -0
  75. package/dist/cli/commands/analytics/cost/dispatch-extractor.d.ts +8 -13
  76. package/dist/cli/commands/analytics/cost/dispatch-extractor.d.ts.map +1 -1
  77. package/dist/cli/commands/analytics/cost/dispatch-extractor.js +131 -69
  78. package/dist/cli/commands/analytics/cost/dispatch-extractor.js.map +1 -1
  79. package/dist/cli/commands/analytics/cost/types.d.ts +39 -0
  80. package/dist/cli/commands/analytics/cost/types.d.ts.map +1 -1
  81. package/dist/cli/commands/analytics/cost/types.js.map +1 -1
  82. package/dist/cli/commands/analytics/cost/usage-readers.d.ts +2 -0
  83. package/dist/cli/commands/analytics/cost/usage-readers.d.ts.map +1 -1
  84. package/dist/cli/commands/analytics/cost/usage-readers.js +14 -3
  85. package/dist/cli/commands/analytics/cost/usage-readers.js.map +1 -1
  86. package/dist/cli/commands/analytics/data-loader.d.ts +13 -0
  87. package/dist/cli/commands/analytics/data-loader.d.ts.map +1 -1
  88. package/dist/cli/commands/analytics/data-loader.js +6 -0
  89. package/dist/cli/commands/analytics/data-loader.js.map +1 -1
  90. package/dist/cli/commands/analytics/native-loader.d.ts +1 -1
  91. package/dist/cli/commands/analytics/native-loader.d.ts.map +1 -1
  92. package/dist/cli/commands/analytics/native-loader.js +25 -3
  93. package/dist/cli/commands/analytics/native-loader.js.map +1 -1
  94. package/dist/cli/commands/analytics/otel-loader.d.ts.map +1 -1
  95. package/dist/cli/commands/analytics/otel-loader.js +5 -0
  96. package/dist/cli/commands/analytics/otel-loader.js.map +1 -1
  97. package/dist/cli/commands/analytics/report/client/app.js +302 -125
  98. package/dist/cli/commands/analytics/report/payload-builder.d.ts.map +1 -1
  99. package/dist/cli/commands/analytics/report/payload-builder.js +64 -13
  100. package/dist/cli/commands/analytics/report/payload-builder.js.map +1 -1
  101. package/dist/cli/commands/analytics/report/template.html +50 -2
  102. package/dist/cli/commands/analytics/report/types.d.ts +16 -0
  103. package/dist/cli/commands/analytics/report/types.d.ts.map +1 -1
  104. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts +6 -0
  105. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
  106. package/dist/cli/commands/doctor/checks/AgentsCheck.js +37 -33
  107. package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
  108. package/dist/cli/commands/doctor/index.d.ts.map +1 -1
  109. package/dist/cli/commands/doctor/index.js +11 -0
  110. package/dist/cli/commands/doctor/index.js.map +1 -1
  111. package/dist/cli/commands/hook.d.ts.map +1 -1
  112. package/dist/cli/commands/hook.js +72 -12
  113. package/dist/cli/commands/hook.js.map +1 -1
  114. package/dist/cli/commands/install.d.ts.map +1 -1
  115. package/dist/cli/commands/install.js +5 -9
  116. package/dist/cli/commands/install.js.map +1 -1
  117. package/dist/cli/commands/mcp/index.d.ts.map +1 -1
  118. package/dist/cli/commands/mcp/index.js +68 -17
  119. package/dist/cli/commands/mcp/index.js.map +1 -1
  120. package/dist/cli/commands/proxy/connectors/desktop.d.ts +13 -9
  121. package/dist/cli/commands/proxy/connectors/desktop.d.ts.map +1 -1
  122. package/dist/cli/commands/proxy/connectors/desktop.js +27 -13
  123. package/dist/cli/commands/proxy/connectors/desktop.js.map +1 -1
  124. package/dist/cli/commands/setup.d.ts.map +1 -1
  125. package/dist/cli/commands/setup.js +72 -24
  126. package/dist/cli/commands/setup.js.map +1 -1
  127. package/dist/cli/commands/tips.d.ts +10 -0
  128. package/dist/cli/commands/tips.d.ts.map +1 -0
  129. package/dist/cli/commands/tips.js +142 -0
  130. package/dist/cli/commands/tips.js.map +1 -0
  131. package/dist/cli/commands/update.d.ts.map +1 -1
  132. package/dist/cli/commands/update.js +12 -10
  133. package/dist/cli/commands/update.js.map +1 -1
  134. package/dist/cli/commands/whatsnew.d.ts +6 -0
  135. package/dist/cli/commands/whatsnew.d.ts.map +1 -0
  136. package/dist/cli/commands/whatsnew.js +37 -0
  137. package/dist/cli/commands/whatsnew.js.map +1 -0
  138. package/dist/cli/first-time.d.ts.map +1 -1
  139. package/dist/cli/first-time.js +4 -0
  140. package/dist/cli/first-time.js.map +1 -1
  141. package/dist/cli/index.js +4 -0
  142. package/dist/cli/index.js.map +1 -1
  143. package/dist/providers/core/types.d.ts +15 -0
  144. package/dist/providers/core/types.d.ts.map +1 -1
  145. package/dist/providers/core/types.js.map +1 -1
  146. package/dist/providers/integration/setup-ui.d.ts +5 -3
  147. package/dist/providers/integration/setup-ui.d.ts.map +1 -1
  148. package/dist/providers/integration/setup-ui.js +6 -4
  149. package/dist/providers/integration/setup-ui.js.map +1 -1
  150. package/dist/providers/plugins/ollama/ollama.library.d.ts +37 -0
  151. package/dist/providers/plugins/ollama/ollama.library.d.ts.map +1 -0
  152. package/dist/providers/plugins/ollama/ollama.library.js +105 -0
  153. package/dist/providers/plugins/ollama/ollama.library.js.map +1 -0
  154. package/dist/providers/plugins/ollama/ollama.models.d.ts +3 -1
  155. package/dist/providers/plugins/ollama/ollama.models.d.ts.map +1 -1
  156. package/dist/providers/plugins/ollama/ollama.models.js +5 -39
  157. package/dist/providers/plugins/ollama/ollama.models.js.map +1 -1
  158. package/dist/providers/plugins/ollama/ollama.setup-steps.d.ts.map +1 -1
  159. package/dist/providers/plugins/ollama/ollama.setup-steps.js +196 -6
  160. package/dist/providers/plugins/ollama/ollama.setup-steps.js.map +1 -1
  161. package/dist/providers/plugins/ollama/ollama.template.d.ts.map +1 -1
  162. package/dist/providers/plugins/ollama/ollama.template.js +12 -32
  163. package/dist/providers/plugins/ollama/ollama.template.js.map +1 -1
  164. package/dist/providers/plugins/sso/session/BaseProcessor.d.ts +4 -0
  165. package/dist/providers/plugins/sso/session/BaseProcessor.d.ts.map +1 -1
  166. package/dist/providers/plugins/sso/session/SessionSyncer.d.ts +12 -0
  167. package/dist/providers/plugins/sso/session/SessionSyncer.d.ts.map +1 -1
  168. package/dist/providers/plugins/sso/session/SessionSyncer.js +89 -0
  169. package/dist/providers/plugins/sso/session/SessionSyncer.js.map +1 -1
  170. package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.d.ts.map +1 -1
  171. package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.js +75 -41
  172. package/dist/providers/plugins/sso/session/processors/conversations/syncProcessor.js.map +1 -1
  173. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.d.ts.map +1 -1
  174. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js +23 -4
  175. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js.map +1 -1
  176. package/dist/utils/cli-updater.d.ts.map +1 -1
  177. package/dist/utils/cli-updater.js +2 -8
  178. package/dist/utils/cli-updater.js.map +1 -1
  179. package/dist/utils/env.d.ts +12 -0
  180. package/dist/utils/env.d.ts.map +1 -0
  181. package/dist/utils/env.js +18 -0
  182. package/dist/utils/env.js.map +1 -0
  183. package/dist/utils/hook-command.d.ts +6 -0
  184. package/dist/utils/hook-command.d.ts.map +1 -1
  185. package/dist/utils/hook-command.js +40 -1
  186. package/dist/utils/hook-command.js.map +1 -1
  187. package/dist/utils/pricing.json +14 -6
  188. package/dist/utils/tips.d.ts +103 -0
  189. package/dist/utils/tips.d.ts.map +1 -0
  190. package/dist/utils/tips.js +221 -0
  191. package/dist/utils/tips.js.map +1 -0
  192. package/dist/utils/version-warnings.d.ts +41 -0
  193. package/dist/utils/version-warnings.d.ts.map +1 -0
  194. package/dist/utils/version-warnings.js +93 -0
  195. package/dist/utils/version-warnings.js.map +1 -0
  196. package/dist/utils/whatsnew.d.ts +83 -0
  197. package/dist/utils/whatsnew.d.ts.map +1 -0
  198. package/dist/utils/whatsnew.js +200 -0
  199. package/dist/utils/whatsnew.js.map +1 -0
  200. package/package.json +3 -1
  201. package/scripts/release.sh +6 -0
  202. package/src/utils/tips.json +806 -0
@@ -0,0 +1,83 @@
1
+ /**
2
+ * What's New — release notes from CHANGELOG.md
3
+ *
4
+ * CHANGELOG.md (Keep a Changelog format) is the curated source of truth for
5
+ * release notes. It ships inside the npm package and is consumed by:
6
+ * - `codemie whatsnew` — browse notes for the current, one, or all versions
7
+ * - the once-per-upgrade startup notice in bin/codemie.js, which shows the
8
+ * current version's notes once and records a `.last-seen-version` marker
9
+ * under the CodeMie home directory
10
+ *
11
+ * This module must stay safe to import from the bin entry point, so its
12
+ * dependencies are limited to fs/path/chalk plus the logger, paths, and tips
13
+ * utilities — never commander or the CLI layer.
14
+ *
15
+ * Environment Variables:
16
+ * - CODEMIE_TIPS=false|0|no: also suppresses the upgrade notice. The "reduce
17
+ * chatter" switch is shared with feature tips on purpose — see tips.ts.
18
+ */
19
+ /**
20
+ * One `### Section` block inside a release entry.
21
+ */
22
+ export interface ReleaseSection {
23
+ title: string;
24
+ items: string[];
25
+ }
26
+ /**
27
+ * One `## [version]` release entry from the changelog.
28
+ */
29
+ export interface ReleaseEntry {
30
+ version: string;
31
+ date?: string;
32
+ sections: ReleaseSection[];
33
+ }
34
+ /**
35
+ * Tolerant Keep-a-Changelog parser. Recognizes `## [x.y.z] - date` headings,
36
+ * `### Section` subheadings, and `- item` bullets; everything else is skipped.
37
+ */
38
+ export declare function parseChangelog(content: string): ReleaseEntry[];
39
+ /**
40
+ * Locate CHANGELOG.md at the package root. Works both from src/utils (dev
41
+ * repo) and dist/utils (built/installed package) — the root is two levels up
42
+ * in both layouts.
43
+ *
44
+ * @returns Absolute path to CHANGELOG.md, or null when it is not shipped
45
+ */
46
+ export declare function getChangelogPath(): string | null;
47
+ /**
48
+ * Read release notes from the changelog.
49
+ *
50
+ * @param version - When given, the entry for this exact version; if there is
51
+ * no matching heading, falls back to the newest versioned entry (or
52
+ * Unreleased when that is all there is) so the once-per-upgrade notice
53
+ * always has something to show
54
+ * @returns Parsed entries (newest first, as written), or an empty array when
55
+ * the changelog is missing or unparseable
56
+ */
57
+ export declare function getReleaseNotes(version?: string): ReleaseEntry[];
58
+ /**
59
+ * Version for which the upgrade notice was last shown, or null if never.
60
+ * Best-effort: an unreadable marker is treated as "never seen".
61
+ */
62
+ export declare function getLastSeenVersion(): string | null;
63
+ /**
64
+ * Record that the upgrade notice was shown for a version. Best-effort: write
65
+ * failures are swallowed — worst case the notice shows once more.
66
+ */
67
+ export declare function markVersionSeen(version: string): void;
68
+ /**
69
+ * Render release notes to the console. Never throws.
70
+ *
71
+ * @param options.maxItems - Cap on the total number of bullets printed across
72
+ * all entries; when truncated, a pointer to `codemie whatsnew` is appended
73
+ */
74
+ export declare function renderReleaseNotes(entries: ReleaseEntry[], options?: {
75
+ maxItems?: number;
76
+ }): void;
77
+ /**
78
+ * Whether the once-per-upgrade notice may print. Deliberately shares the
79
+ * CODEMIE_TIPS switch with feature tips — one "reduce chatter" toggle for all
80
+ * informational CLI output.
81
+ */
82
+ export declare function isWhatsNewEnabled(): boolean;
83
+ //# sourceMappingURL=whatsnew.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsnew.d.ts","sourceRoot":"","sources":["../../src/utils/whatsnew.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AASH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,cAAc,EAAE,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CAoC9D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,GAAG,IAAI,CAGhD;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,YAAY,EAAE,CAkChE;AAID;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAMlD;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAQrD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgDjG;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C"}
@@ -0,0 +1,200 @@
1
+ /**
2
+ * What's New — release notes from CHANGELOG.md
3
+ *
4
+ * CHANGELOG.md (Keep a Changelog format) is the curated source of truth for
5
+ * release notes. It ships inside the npm package and is consumed by:
6
+ * - `codemie whatsnew` — browse notes for the current, one, or all versions
7
+ * - the once-per-upgrade startup notice in bin/codemie.js, which shows the
8
+ * current version's notes once and records a `.last-seen-version` marker
9
+ * under the CodeMie home directory
10
+ *
11
+ * This module must stay safe to import from the bin entry point, so its
12
+ * dependencies are limited to fs/path/chalk plus the logger, paths, and tips
13
+ * utilities — never commander or the CLI layer.
14
+ *
15
+ * Environment Variables:
16
+ * - CODEMIE_TIPS=false|0|no: also suppresses the upgrade notice. The "reduce
17
+ * chatter" switch is shared with feature tips on purpose — see tips.ts.
18
+ */
19
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
20
+ import path from 'path';
21
+ import chalk from 'chalk';
22
+ import { logger } from './logger.js';
23
+ import { getCodemiePath, getDirname } from './paths.js';
24
+ import { isTipsEnabled } from './tips.js';
25
+ /**
26
+ * Tolerant Keep-a-Changelog parser. Recognizes `## [x.y.z] - date` headings,
27
+ * `### Section` subheadings, and `- item` bullets; everything else is skipped.
28
+ */
29
+ export function parseChangelog(content) {
30
+ const entries = [];
31
+ let currentEntry = null;
32
+ let currentSection = null;
33
+ for (const line of content.split(/\r?\n/)) {
34
+ const versionMatch = line.match(/^##\s+\[([^\]]+)\](?:\s*-\s*(.+?))?\s*$/);
35
+ if (versionMatch) {
36
+ currentEntry = {
37
+ version: versionMatch[1].trim(),
38
+ date: versionMatch[2]?.trim(),
39
+ sections: []
40
+ };
41
+ entries.push(currentEntry);
42
+ currentSection = null;
43
+ continue;
44
+ }
45
+ if (!currentEntry) {
46
+ continue;
47
+ }
48
+ const sectionMatch = line.match(/^###\s+(.+?)\s*$/);
49
+ if (sectionMatch) {
50
+ currentSection = { title: sectionMatch[1].trim(), items: [] };
51
+ currentEntry.sections.push(currentSection);
52
+ continue;
53
+ }
54
+ const itemMatch = line.match(/^\s*[-*]\s+(.+?)\s*$/);
55
+ if (itemMatch && currentSection) {
56
+ currentSection.items.push(itemMatch[1].trim());
57
+ }
58
+ }
59
+ return entries;
60
+ }
61
+ /**
62
+ * Locate CHANGELOG.md at the package root. Works both from src/utils (dev
63
+ * repo) and dist/utils (built/installed package) — the root is two levels up
64
+ * in both layouts.
65
+ *
66
+ * @returns Absolute path to CHANGELOG.md, or null when it is not shipped
67
+ */
68
+ export function getChangelogPath() {
69
+ const changelogPath = path.resolve(getDirname(import.meta.url), '../../CHANGELOG.md');
70
+ return existsSync(changelogPath) ? changelogPath : null;
71
+ }
72
+ /**
73
+ * Read release notes from the changelog.
74
+ *
75
+ * @param version - When given, the entry for this exact version; if there is
76
+ * no matching heading, falls back to the newest versioned entry (or
77
+ * Unreleased when that is all there is) so the once-per-upgrade notice
78
+ * always has something to show
79
+ * @returns Parsed entries (newest first, as written), or an empty array when
80
+ * the changelog is missing or unparseable
81
+ */
82
+ export function getReleaseNotes(version) {
83
+ const changelogPath = getChangelogPath();
84
+ if (!changelogPath) {
85
+ logger.debug('[whatsnew] CHANGELOG.md not found at package root');
86
+ return [];
87
+ }
88
+ try {
89
+ const entries = parseChangelog(readFileSync(changelogPath, 'utf-8'));
90
+ if (entries.length === 0) {
91
+ logger.debug('[whatsnew] CHANGELOG.md parsed to zero release entries', { changelogPath });
92
+ }
93
+ if (!version) {
94
+ return entries;
95
+ }
96
+ const exact = entries.filter(entry => entry.version === version);
97
+ if (exact.length > 0) {
98
+ return exact;
99
+ }
100
+ // No heading for this exact version (changelog not updated for the
101
+ // release) — fall back to the newest versioned entry so the once-per-
102
+ // upgrade notice still shows something before the version is marked seen.
103
+ const fallback = entries.find(entry => entry.version !== 'Unreleased') ?? entries[0];
104
+ if (fallback) {
105
+ logger.debug(`[whatsnew] No changelog entry for ${version} — falling back to ${fallback.version}`);
106
+ return [fallback];
107
+ }
108
+ return [];
109
+ }
110
+ catch (error) {
111
+ logger.debug('[whatsnew] Failed to read changelog:', error);
112
+ return [];
113
+ }
114
+ }
115
+ const lastSeenFilePath = () => getCodemiePath('.last-seen-version');
116
+ /**
117
+ * Version for which the upgrade notice was last shown, or null if never.
118
+ * Best-effort: an unreadable marker is treated as "never seen".
119
+ */
120
+ export function getLastSeenVersion() {
121
+ try {
122
+ return readFileSync(lastSeenFilePath(), 'utf-8').trim() || null;
123
+ }
124
+ catch {
125
+ return null;
126
+ }
127
+ }
128
+ /**
129
+ * Record that the upgrade notice was shown for a version. Best-effort: write
130
+ * failures are swallowed — worst case the notice shows once more.
131
+ */
132
+ export function markVersionSeen(version) {
133
+ try {
134
+ const file = lastSeenFilePath();
135
+ mkdirSync(path.dirname(file), { recursive: true });
136
+ writeFileSync(file, version, 'utf-8');
137
+ }
138
+ catch (error) {
139
+ logger.debug('[whatsnew] Failed to persist last-seen version (non-fatal):', error);
140
+ }
141
+ }
142
+ /**
143
+ * Render release notes to the console. Never throws.
144
+ *
145
+ * @param options.maxItems - Cap on the total number of bullets printed across
146
+ * all entries; when truncated, a pointer to `codemie whatsnew` is appended
147
+ */
148
+ export function renderReleaseNotes(entries, options) {
149
+ try {
150
+ if (entries.length === 0) {
151
+ return;
152
+ }
153
+ let remaining = options?.maxItems ?? Number.POSITIVE_INFINITY;
154
+ let truncated = false;
155
+ console.log();
156
+ for (const entry of entries) {
157
+ if (remaining <= 0) {
158
+ truncated = true;
159
+ break;
160
+ }
161
+ const dateSuffix = entry.date ? ` (${entry.date})` : '';
162
+ console.log(chalk.bold.cyan(`## What's new in ${entry.version}${dateSuffix}`));
163
+ for (const section of entry.sections) {
164
+ if (remaining <= 0) {
165
+ truncated = true;
166
+ break;
167
+ }
168
+ if (section.items.length === 0) {
169
+ continue;
170
+ }
171
+ console.log(chalk.dim(` ${section.title}`));
172
+ for (const item of section.items) {
173
+ if (remaining <= 0) {
174
+ truncated = true;
175
+ break;
176
+ }
177
+ console.log(` • ${item}`);
178
+ remaining--;
179
+ }
180
+ }
181
+ console.log();
182
+ }
183
+ if (truncated) {
184
+ console.log(chalk.dim(' … run `codemie whatsnew` for the full notes'));
185
+ console.log();
186
+ }
187
+ }
188
+ catch (error) {
189
+ logger.debug('[whatsnew] renderReleaseNotes failed (non-fatal):', error);
190
+ }
191
+ }
192
+ /**
193
+ * Whether the once-per-upgrade notice may print. Deliberately shares the
194
+ * CODEMIE_TIPS switch with feature tips — one "reduce chatter" toggle for all
195
+ * informational CLI output.
196
+ */
197
+ export function isWhatsNewEnabled() {
198
+ return isTipsEnabled();
199
+ }
200
+ //# sourceMappingURL=whatsnew.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"whatsnew.js","sourceRoot":"","sources":["../../src/utils/whatsnew.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAmB1C;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,IAAI,YAAY,GAAwB,IAAI,CAAC;IAC7C,IAAI,cAAc,GAA0B,IAAI,CAAC;IAEjD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC3E,IAAI,YAAY,EAAE,CAAC;YACjB,YAAY,GAAG;gBACb,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBAC/B,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE;gBAC7B,QAAQ,EAAE,EAAE;aACb,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YAC3B,cAAc,GAAG,IAAI,CAAC;YACt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SAAS,GAAG,IAAI,CAAC;oBACjB,MAAM;gBACR,CAAC;gBACD,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC/B,SAAS;gBACX,CAAC;gBAED,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;gBAC7C,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;oBACjC,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;wBACnB,SAAS,GAAG,IAAI,CAAC;wBACjB,MAAM;oBACR,CAAC;oBACD,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;oBAC3B,SAAS,EAAE,CAAC;gBACd,CAAC;YACH,CAAC;YACD,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;QAED,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,+CAA+C,CAAC,CAAC,CAAC;YACxE,OAAO,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,CAAC,KAAK,CAAC,mDAAmD,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,aAAa,EAAE,CAAC;AACzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemieai/code",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "Unified AI coding assistant CLI - Manage Claude Code, Gemini & custom agents. Multi-provider support (OpenAI, Azure, LiteLLM, SSO). Built-in LangGraph agent with file operations & git integration.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,7 +26,9 @@
26
26
  "bin",
27
27
  "scripts",
28
28
  "src/workflows/templates/**/*.yml",
29
+ "src/utils/tips.json",
29
30
  "README.md",
31
+ "CHANGELOG.md",
30
32
  "LICENSE"
31
33
  ],
32
34
  "scripts": {
@@ -132,6 +132,12 @@ if ! git diff --quiet || ! git diff --cached --quiet; then
132
132
  fi
133
133
  fi
134
134
 
135
+ # Remind about release notes in CHANGELOG.md (non-blocking; `codemie whatsnew`
136
+ # and the once-per-upgrade notice read them)
137
+ if [[ ! -f CHANGELOG.md ]] || ! grep -q "^## \[$VERSION\]" CHANGELOG.md; then
138
+ printf "\033[33m⚠️ CHANGELOG.md has no '## [%s]' section — add release notes before publishing.\033[0m\n" "$VERSION"
139
+ fi
140
+
135
141
  # Show what will be done
136
142
  echo ""
137
143
  echo "📋 Actions that will be performed:"