storymaps 1.3.0 → 1.3.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
@@ -138,9 +138,10 @@ storymaps diff file1.yml file2.yml # compare two local files
138
138
  ```bash
139
139
  storymaps status # progress overview of storymap.yml
140
140
  storymaps status other.yml # progress overview of a specific file
141
+ storymaps status storymaps.io/abc123 # progress overview of a map on the server, no file needed
141
142
  ```
142
143
 
143
- Progress overview: slices, status counts, and blocked stories.
144
+ Progress overview: slices, status counts, and blocked stories. A link to a map inside a project works too.
144
145
 
145
146
  ### `log`
146
147
 
package/bin/storymaps.js CHANGED
@@ -99,7 +99,7 @@ program
99
99
  program
100
100
  .command('status')
101
101
  .description('Show a progress overview of the story map')
102
- .argument('[file]', 'path to storymap file')
102
+ .argument('[target]', 'storymap file, or a map ID, domain/ID, or full URL')
103
103
  .option('-f, --file <path>', 'path to storymap file', 'storymap.yml')
104
104
  .action(statusCommand);
105
105
 
@@ -5,6 +5,8 @@ import { readFile } from 'node:fs/promises';
5
5
  import { resolve } from 'node:path';
6
6
  import chalk from 'chalk';
7
7
  import jsyaml from 'js-yaml';
8
+ import { resolveTarget } from '../util/identity.js';
9
+ import { getMap, ApiError } from '../util/api.js';
8
10
 
9
11
  const STATUS_ICONS = {
10
12
  'done': chalk.green('●'),
@@ -24,16 +26,34 @@ function pct(n, total) {
24
26
  return `${Math.round((n / total) * 100)}%`;
25
27
  }
26
28
 
27
- export async function statusCommand(target, opts) {
28
- const filePath = resolve(target || opts.file || 'storymap.yml');
29
-
30
- let content;
29
+ // A local file, or else the map on the server when the target is a link or map ID
30
+ async function loadContent(target, opts) {
31
+ const isUrl = target && /^https?:\/\//i.test(target);
32
+ const filePath = resolve((!isUrl && target) || opts.file || 'storymap.yml');
33
+ if (!isUrl) {
34
+ try {
35
+ return await readFile(filePath, 'utf-8');
36
+ } catch {
37
+ if (!target) {
38
+ console.error(chalk.red(`File not found: ${filePath}`));
39
+ process.exit(1);
40
+ }
41
+ }
42
+ }
43
+ const { id, baseUrl } = await resolveTarget(target, resolve(opts.file || 'storymap.yml'));
31
44
  try {
32
- content = await readFile(filePath, 'utf-8');
33
- } catch {
34
- console.error(chalk.red(`File not found: ${filePath}`));
35
- process.exit(1);
45
+ return (await getMap(baseUrl, id, 'yaml')).data;
46
+ } catch (err) {
47
+ if (err instanceof ApiError && err.status === 404 && !isUrl && !target.includes('/')) {
48
+ console.error(chalk.red(`No file or map found: ${target}`));
49
+ process.exit(1);
50
+ }
51
+ throw err;
36
52
  }
53
+ }
54
+
55
+ export async function statusCommand(target, opts) {
56
+ const content = await loadContent(target, opts);
37
57
 
38
58
  const map = jsyaml.load(content);
39
59
  if (!map || typeof map !== 'object') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storymaps",
3
- "version": "1.3.0",
3
+ "version": "1.3.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": {