heyiam 0.2.22 → 0.2.23

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/dist/config.js CHANGED
@@ -1,2 +1,4 @@
1
1
  /** Base URL for the heyiam.com app API. Override with HEYIAM_API_URL for local dev. */
2
2
  export const API_URL = process.env.HEYIAM_API_URL ?? 'https://heyiam.com';
3
+ /** Base URL for the heyi.am public site. Override with HEYIAM_PUBLIC_URL for local dev. */
4
+ export const PUBLIC_URL = process.env.HEYIAM_PUBLIC_URL ?? 'https://heyi.am';
package/dist/export.js CHANGED
@@ -11,7 +11,7 @@ import { join, resolve, dirname } from 'node:path';
11
11
  import { fileURLToPath } from 'node:url';
12
12
  import { loadEnhancedData } from './settings.js';
13
13
  import { renderProjectHtml, renderSessionHtml } from './render/index.js';
14
- import { escapeHtml } from './format-utils.js';
14
+ import { escapeHtml, displayNameFromDir } from './format-utils.js';
15
15
  import { buildProjectRenderData, buildSessionRenderData, buildSessionCard, } from './render/build-render-data.js';
16
16
  import { mergeActiveIntervals, sumIntervalMs } from './bridge.js';
17
17
  import { SCREENSHOTS_DIR } from './screenshot.js';
@@ -95,7 +95,7 @@ export async function exportMarkdown(dirName, cache, sessions, outputPath) {
95
95
  let totalBytes = 0;
96
96
  mkdirSync(outputPath, { recursive: true });
97
97
  const { result } = cache;
98
- const title = dirName.replace(/^-/, '').replace(/-/g, ' ');
98
+ const title = cache.title ?? displayNameFromDir(dirName);
99
99
  // README.md — project narrative
100
100
  const readme = buildReadme(title, result, sessions);
101
101
  totalBytes += writeAndTrack(join(outputPath, 'README.md'), readme, files);
@@ -207,7 +207,7 @@ export async function exportHtml(dirName, cache, sessions, outputPath, username
207
207
  mkdirSync(outputPath, { recursive: true });
208
208
  const { result } = cache;
209
209
  const slug = slugify(dirName);
210
- const title = dirName.replace(/^-/, '').replace(/-/g, ' ');
210
+ const title = opts?.title ?? cache.title ?? displayNameFromDir(dirName);
211
211
  // Use ALL sessions (same as dashboard), build cards for each
212
212
  const sessionCards = sessions.map((session) => {
213
213
  return buildSessionCard({
@@ -305,7 +305,7 @@ function getInlineCss() {
305
305
  function buildProjectRenderInputs(dirName, cache, sessions, username, opts) {
306
306
  const { result } = cache;
307
307
  const slug = slugify(dirName);
308
- const title = dirName.replace(/^-/, '').replace(/-/g, ' ');
308
+ const title = opts?.title ?? cache.title ?? displayNameFromDir(dirName);
309
309
  const sessionCards = sessions.map((session) => buildSessionCard({
310
310
  sessionId: session.id,
311
311
  session,
@@ -331,7 +331,9 @@ function buildProjectRenderInputs(dirName, cache, sessions, username, opts) {
331
331
  */
332
332
  export function generateProjectHtmlFragment(dirName, cache, sessions, username = 'local', opts) {
333
333
  const { result, slug, title, sessionCards, totalLoc, totalDurationMinutes, totalAgentDurationMinutes, totalFilesChanged, totalTokens } = buildProjectRenderInputs(dirName, cache, sessions, username, opts);
334
- const screenshotUrl = resolveScreenshotDataUri(dirName, cache);
334
+ // Use explicit URL override (e.g. public https:// path for server upload),
335
+ // fall back to embedded data URI for standalone local export
336
+ const screenshotUrl = opts?.screenshotUrl ?? resolveScreenshotDataUri(dirName, cache);
335
337
  const renderData = buildProjectRenderData({
336
338
  username, slug, title,
337
339
  narrative: result.narrative,
@@ -8,6 +8,14 @@ export function formatLoc(loc) {
8
8
  return `${(loc / 1000).toFixed(1)}k`;
9
9
  return String(loc);
10
10
  }
11
+ /** Derive a human-readable project name from the encoded directory name. */
12
+ export function displayNameFromDir(dirName) {
13
+ const devIdx = dirName.indexOf('-Dev-');
14
+ if (devIdx !== -1)
15
+ return dirName.slice(devIdx + 5);
16
+ const segments = dirName.split('-').filter(Boolean);
17
+ return segments.length > 0 ? segments[segments.length - 1] : dirName;
18
+ }
11
19
  /** Escape LIKE wildcards in user input for safe use in SQL LIKE clauses. */
12
20
  export function escapeLikeWildcards(str) {
13
21
  return str.replace(/[%_]/g, (c) => `\\${c}`);