storymaps 1.1.2 → 1.2.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.
package/README.md CHANGED
@@ -133,6 +133,15 @@ storymaps status other.yml # progress overview of a specific file
133
133
 
134
134
  Progress overview: slices, status counts, and blocked stories.
135
135
 
136
+ ### `log`
137
+
138
+ ```bash
139
+ storymaps log # activity log for storymap.yml
140
+ storymaps log storymaps.io/abc123 # activity log for a specific map
141
+ ```
142
+
143
+ Shows timestamped activity entries with source labels (cli, mobile, web).
144
+
136
145
  ### `lock` / `unlock`
137
146
 
138
147
  ```bash
package/bin/storymaps.js CHANGED
@@ -16,6 +16,7 @@ import { openCommand } from '../lib/commands/open.js';
16
16
  import { lockCommand } from '../lib/commands/lock.js';
17
17
  import { unlockCommand } from '../lib/commands/unlock.js';
18
18
  import { statusCommand } from '../lib/commands/status.js';
19
+ import { logCommand } from '../lib/commands/log.js';
19
20
 
20
21
 
21
22
  const program = new Command();
@@ -101,6 +102,12 @@ program
101
102
  .option('-f, --file <path>', 'path to storymap file', 'storymap.yml')
102
103
  .action(statusCommand);
103
104
 
105
+ program
106
+ .command('log')
107
+ .description('Show activity log for a map')
108
+ .argument('[target]', 'map ID, domain/ID, or full URL')
109
+ .option('-f, --file <path>', 'local file path', 'storymap.yml')
110
+ .action(logCommand);
104
111
 
105
112
  program.parseAsync().catch(err => {
106
113
  const message = err.name === 'ExitPromptError' ? 'Cancelled.'
@@ -0,0 +1,42 @@
1
+ // Storymaps CLI — AGPL-3.0 — see LICENCE for details
2
+ // storymaps log — show activity log for a map
3
+
4
+ import { resolve } from 'node:path';
5
+ import chalk from 'chalk';
6
+ import { resolveTarget } from '../util/identity.js';
7
+ import { getLog } from '../util/api.js';
8
+
9
+ function formatTime(ts) {
10
+ const d = new Date(ts);
11
+ const now = new Date();
12
+ const pad = (n) => String(n).padStart(2, '0');
13
+ const time = `${pad(d.getHours())}:${pad(d.getMinutes())}`;
14
+
15
+ if (d.toDateString() === now.toDateString()) return time;
16
+ return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${time}`;
17
+ }
18
+
19
+ function sourceLabel(entry) {
20
+ if (entry.src === 'cli') return '>_';
21
+ if (entry.src === 'mobile') return '📱';
22
+ return '🌐';
23
+ }
24
+
25
+ export async function logCommand(target, opts) {
26
+ const filePath = resolve(opts.file || 'storymap.yml');
27
+ const { id, baseUrl } = await resolveTarget(target, filePath);
28
+
29
+ const entries = await getLog(baseUrl, id);
30
+
31
+ if (entries.length === 0) {
32
+ console.log(chalk.dim('No activity yet.'));
33
+ return;
34
+ }
35
+
36
+ for (const entry of entries) {
37
+ const time = chalk.dim(formatTime(entry.ts));
38
+ const icon = sourceLabel(entry);
39
+ const who = entry.src !== 'cli' ? `${entry.name || 'guest'}: ` : '';
40
+ console.log(`${time} ${icon} ${who}${entry.text}`);
41
+ }
42
+ }
package/lib/util/api.js CHANGED
@@ -97,4 +97,10 @@ export async function removeLock(baseUrl, id, passwordHash) {
97
97
  return res.json();
98
98
  }
99
99
 
100
+ export async function getLog(baseUrl, id) {
101
+ const res = await fetch(`${baseUrl}/api/maps/${id}/log`);
102
+ await handleResponse(res);
103
+ return res.json();
104
+ }
105
+
100
106
  export { ApiError };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storymaps",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "description": "CLI tool for storymaps.io - import, export, validate, and manage user story maps from the terminal",
5
5
  "type": "module",
6
6
  "bin": {