mdboard 1.1.0 → 1.3.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.
package/bin.js CHANGED
@@ -3,11 +3,14 @@
3
3
  const path = require('path');
4
4
  const args = process.argv.slice(2);
5
5
 
6
- // Pre-process --config flag before dispatching commands
6
+ // Pre-process --config and --workspace flags before dispatching commands
7
7
  for (let i = 0; i < args.length; i++) {
8
8
  if (args[i] === '--config' && args[i + 1]) {
9
9
  process.env.MDBOARD_CONFIG = path.resolve(args[i + 1]);
10
10
  }
11
+ if (args[i] === '--workspace' && args[i + 1]) {
12
+ process.env.MDBOARD_WORKSPACE = path.resolve(args[i + 1]);
13
+ }
11
14
  }
12
15
 
13
16
  const command = args[0];
@@ -24,13 +27,71 @@ if (command === '--help' || command === '-h') {
24
27
  }
25
28
 
26
29
  if (command === 'init') {
27
- require('./init.js');
30
+ const initArgs = args.slice(1).filter(a => !a.startsWith('--'));
31
+ process.env.MDBOARD_INIT_NAME = initArgs[0] || '';
32
+ require('./src/cli/init.js');
28
33
  } else if (command === 'help') {
29
34
  printHelp();
30
35
  process.exit(0);
36
+ } else if (command === 'cache') {
37
+ handleCache();
38
+ } else if (command === 'status') {
39
+ const { resolveProjectDir } = require('./src/cli/cli');
40
+ const { generateStatus } = require('./src/cli/status');
41
+ generateStatus(resolveProjectDir(args));
42
+ } else if (command === 'sync') {
43
+ const { resolveProjectDir, parseFlags } = require('./src/cli/cli');
44
+ const { runSync } = require('./src/cli/sync');
45
+ const { flags } = parseFlags(args.slice(1));
46
+ runSync(resolveProjectDir(args), { fix: !!flags.fix });
47
+ } else if (command === 'theme') {
48
+ const { handleTheme } = require('./src/cli/theme');
49
+ handleTheme(args.slice(1));
50
+ process.exit(0);
51
+ } else if (command === 'create') {
52
+ const { resolveProjectDir, handleCreate } = require('./src/cli/cli');
53
+ handleCreate(resolveProjectDir(args), args.slice(1));
54
+ } else if (command === 'update') {
55
+ const { resolveProjectDir, handleUpdate } = require('./src/cli/cli');
56
+ handleUpdate(resolveProjectDir(args), args.slice(1));
57
+ } else if (command === 'delete') {
58
+ const { resolveProjectDir, handleDelete } = require('./src/cli/cli');
59
+ handleDelete(resolveProjectDir(args), args.slice(1));
31
60
  } else {
32
61
  // Default: start server. Pass all args through.
33
- require('./server.js');
62
+ require('./src/server/server.js');
63
+ }
64
+
65
+ function handleCache() {
66
+ const subCmd = args[1];
67
+ const { listCache, cleanCache, CACHE_DIR } = require('./src/core/workspace');
68
+
69
+ if (subCmd === 'list') {
70
+ const entries = listCache();
71
+ if (entries.length === 0) {
72
+ console.log('\n No cached remote repos.\n Cache dir: ' + CACHE_DIR + '\n');
73
+ } else {
74
+ console.log('\n Cached remote repos (' + CACHE_DIR + '):\n');
75
+ entries.forEach(function(e) { console.log(' ' + e); });
76
+ console.log('');
77
+ }
78
+ } else if (subCmd === 'clean') {
79
+ const ok = cleanCache();
80
+ if (ok) {
81
+ console.log('\n Cache cleaned successfully.\n');
82
+ } else {
83
+ console.log('\n No cache to clean or error occurred.\n');
84
+ }
85
+ } else {
86
+ console.log(`
87
+ mdboard cache — Manage remote source cache
88
+
89
+ Subcommands:
90
+ mdboard cache list List cached remote repos
91
+ mdboard cache clean Remove all cached repos
92
+ `);
93
+ }
94
+ process.exit(0);
34
95
  }
35
96
 
36
97
  function printHelp() {
@@ -39,19 +100,31 @@ function printHelp() {
39
100
 
40
101
  Usage:
41
102
  mdboard Start the dashboard server
42
- mdboard init Scaffold a new project/ directory
103
+ mdboard init [name] Scaffold a new workspace (prompts if no name)
104
+ mdboard status Generate project/status.md from current state
105
+ mdboard sync [--fix] Check consistency; --fix to auto-correct
106
+ mdboard create <entity> Create milestone, epic, task, or sprint
107
+ mdboard update <entity> Update an entity's frontmatter fields
108
+ mdboard delete <entity> Delete an entity and clean references
109
+ mdboard theme List available themes
110
+ mdboard theme <name> Set theme globally
111
+ mdboard theme <n> --project Set theme for current project
112
+ mdboard cache list|clean Manage remote source cache
43
113
  mdboard --version Print version
44
114
  mdboard --help Show this help
45
115
 
116
+ CRUD examples:
117
+ mdboard create milestone "MVP"
118
+ mdboard create epic "Auth" --milestone mvp
119
+ mdboard create task "Login" --milestone mvp --epic auth
120
+ mdboard create sprint --milestone mvp --goal "Sprint 1"
121
+ mdboard update task TASK-001 --status in-progress
122
+ mdboard delete task TASK-001
123
+
46
124
  Server options:
47
125
  --project <path> Workspace root directory (default: cwd)
48
126
  --port <number> Server port (default: 3333)
49
127
  --config <path> Path to mdboard.json config file
50
-
51
- Examples:
52
- npx mdboard Start dashboard in current directory
53
- npx mdboard init Create project/ with templates
54
- npx mdboard --port 4000 Start on port 4000
55
- npx mdboard --config ./my-config.json
128
+ --workspace <path> Path to workspace.json
56
129
  `);
57
130
  }
package/build.js ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const CLIENT_DIR = path.join(__dirname, 'src', 'client');
8
+ const OUT_FILE = path.join(__dirname, 'index.html');
9
+
10
+ const JS_FILES = [
11
+ 'themes.js',
12
+ 'core.js',
13
+ 'workspace.js',
14
+ 'editor.js',
15
+ 'board.js',
16
+ 'table.js',
17
+ 'milestones.js',
18
+ 'metrics.js',
19
+ 'overview.js',
20
+ 'notes.js',
21
+ 'panel.js',
22
+ 'history.js',
23
+ 'app.js',
24
+ ];
25
+
26
+ // Read template
27
+ const template = fs.readFileSync(path.join(CLIENT_DIR, 'template.html'), 'utf8');
28
+
29
+ // Read CSS
30
+ const css = fs.readFileSync(path.join(CLIENT_DIR, 'styles.css'), 'utf8');
31
+
32
+ // Read and concatenate JS files
33
+ const js = JS_FILES
34
+ .map(f => fs.readFileSync(path.join(CLIENT_DIR, f), 'utf8'))
35
+ .join('\n\n');
36
+
37
+ // Replace placeholders
38
+ let output = template.replace('<!-- STYLES -->', css);
39
+ output = output.replace('<!-- SCRIPTS -->', js);
40
+
41
+ fs.writeFileSync(OUT_FILE, output, 'utf8');
42
+
43
+ const lines = output.split('\n').length;
44
+ console.log(`Built index.html (${lines} lines, ${Buffer.byteLength(output)} bytes)`);