mdboard 1.3.0 → 2.0.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.
Files changed (53) hide show
  1. package/bin.js +117 -59
  2. package/index.html +2101 -1594
  3. package/package.json +7 -5
  4. package/presets/kanban/api.json +91 -0
  5. package/presets/kanban/cli.json +69 -0
  6. package/presets/kanban/docs.json +29 -0
  7. package/presets/kanban/entities.json +128 -0
  8. package/presets/kanban/structure.json +15 -0
  9. package/presets/kanban/ui.json +86 -0
  10. package/presets/scrum/api.json +98 -0
  11. package/presets/scrum/cli.json +120 -0
  12. package/presets/scrum/docs.json +43 -0
  13. package/presets/scrum/entities.json +268 -0
  14. package/presets/scrum/structure.json +32 -0
  15. package/presets/scrum/ui.json +201 -0
  16. package/presets/shape-up/api.json +40 -0
  17. package/presets/shape-up/cli.json +44 -0
  18. package/presets/shape-up/docs.json +32 -0
  19. package/presets/shape-up/entities.json +140 -0
  20. package/presets/shape-up/structure.json +28 -0
  21. package/presets/shape-up/ui.json +114 -0
  22. package/src/cli/cli.js +186 -210
  23. package/src/cli/config.js +234 -0
  24. package/src/cli/init.js +128 -76
  25. package/src/cli/preset.js +849 -0
  26. package/src/cli/skill.js +417 -0
  27. package/src/cli/status.js +126 -96
  28. package/src/core/config.js +491 -38
  29. package/src/core/history.js +17 -1
  30. package/src/core/scanner.js +373 -463
  31. package/src/core/workspace.js +0 -15
  32. package/src/server/api.js +464 -741
  33. package/src/server/server.js +105 -130
  34. package/build.js +0 -44
  35. package/defaults.json +0 -43
  36. package/src/cli/sync.js +0 -194
  37. package/src/cli/theme.js +0 -142
  38. package/src/client/app.js +0 -266
  39. package/src/client/board.js +0 -157
  40. package/src/client/core.js +0 -331
  41. package/src/client/editor.js +0 -318
  42. package/src/client/history.js +0 -137
  43. package/src/client/metrics.js +0 -38
  44. package/src/client/milestones.js +0 -77
  45. package/src/client/notes.js +0 -183
  46. package/src/client/overview.js +0 -104
  47. package/src/client/panel.js +0 -637
  48. package/src/client/styles.css +0 -471
  49. package/src/client/table.js +0 -111
  50. package/src/client/template.html +0 -144
  51. package/src/client/themes.js +0 -261
  52. package/src/client/workspace.js +0 -164
  53. package/src/core/agent-scanner.js +0 -260
package/bin.js CHANGED
@@ -1,9 +1,18 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ /**
4
+ * mdboard — CLI entry point
5
+ *
6
+ * All commands, entity types, and flags are resolved dynamically from config.
7
+ * The only hardcoded commands are structural: init, help, version, cache, theme, server.
8
+ */
9
+
10
+ 'use strict';
11
+
3
12
  const path = require('path');
4
13
  const args = process.argv.slice(2);
5
14
 
6
- // Pre-process --config and --workspace flags before dispatching commands
15
+ // Pre-process global flags before dispatching commands
7
16
  for (let i = 0; i < args.length; i++) {
8
17
  if (args[i] === '--config' && args[i + 1]) {
9
18
  process.env.MDBOARD_CONFIG = path.resolve(args[i + 1]);
@@ -11,44 +20,54 @@ for (let i = 0; i < args.length; i++) {
11
20
  if (args[i] === '--workspace' && args[i + 1]) {
12
21
  process.env.MDBOARD_WORKSPACE = path.resolve(args[i + 1]);
13
22
  }
23
+ if (args[i] === '--preset' && args[i + 1]) {
24
+ process.env.MDBOARD_PRESET = args[i + 1];
25
+ }
14
26
  }
15
27
 
16
28
  const command = args[0];
17
29
 
30
+ // --- Version ---
18
31
  if (command === '--version' || command === '-v') {
19
32
  const pkg = require('./package.json');
20
33
  console.log('mdboard v' + pkg.version);
21
34
  process.exit(0);
22
35
  }
23
36
 
24
- if (command === '--help' || command === '-h') {
37
+ // --- Help ---
38
+ if (command === '--help' || command === '-h' || command === 'help') {
25
39
  printHelp();
26
40
  process.exit(0);
27
41
  }
28
42
 
43
+ // --- Init ---
29
44
  if (command === 'init') {
30
- const initArgs = args.slice(1).filter(a => !a.startsWith('--'));
31
- process.env.MDBOARD_INIT_NAME = initArgs[0] || '';
32
- require('./src/cli/init.js');
33
- } else if (command === 'help') {
34
- printHelp();
45
+ require('./src/cli/init');
35
46
  process.exit(0);
36
- } else if (command === 'cache') {
47
+ }
48
+
49
+ // --- Cache ---
50
+ if (command === 'cache') {
37
51
  handleCache();
38
- } else if (command === 'status') {
52
+ process.exit(0);
53
+ }
54
+
55
+ // --- History ---
56
+ if (command === 'history') {
57
+ handleHistory();
58
+ process.exit(0);
59
+ }
60
+
61
+ // --- Status ---
62
+ if (command === 'status') {
39
63
  const { resolveProjectDir } = require('./src/cli/cli');
40
64
  const { generateStatus } = require('./src/cli/status');
41
65
  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
66
  process.exit(0);
51
- } else if (command === 'create') {
67
+ }
68
+
69
+ // --- CRUD: create, update, delete ---
70
+ if (command === 'create') {
52
71
  const { resolveProjectDir, handleCreate } = require('./src/cli/cli');
53
72
  handleCreate(resolveProjectDir(args), args.slice(1));
54
73
  } else if (command === 'update') {
@@ -57,11 +76,28 @@ if (command === 'init') {
57
76
  } else if (command === 'delete') {
58
77
  const { resolveProjectDir, handleDelete } = require('./src/cli/cli');
59
78
  handleDelete(resolveProjectDir(args), args.slice(1));
60
- } else {
61
- // Default: start server. Pass all args through.
79
+ } else if (command === 'list') {
80
+ const { resolveProjectDir, handleList } = require('./src/cli/cli');
81
+ handleList(resolveProjectDir(args), args.slice(1));
82
+ } else if (command === 'preset') {
83
+ require('./src/cli/preset').run(args.slice(1));
84
+ } else if (command === 'config') {
85
+ require('./src/cli/config').run(args.slice(1));
86
+ // readline keeps process alive; config.js calls process.exit(0) when done
87
+ } else if (command === 'skill') {
88
+ require('./src/cli/skill').run(args.slice(1));
89
+ // readline keeps process alive; skill.js calls process.exit(0) when done
90
+ } else if (!command || command.startsWith('--')) {
91
+ // Default: start server (flags like --port are handled by server.js)
62
92
  require('./src/server/server.js');
93
+ } else {
94
+ console.error(' Unknown command: ' + command);
95
+ console.error(' Run `mdboard --help` for usage.');
96
+ process.exit(1);
63
97
  }
64
98
 
99
+ // --- Cache handler ---
100
+
65
101
  function handleCache() {
66
102
  const subCmd = args[1];
67
103
  const { listCache, cleanCache, CACHE_DIR } = require('./src/core/workspace');
@@ -83,48 +119,70 @@ function handleCache() {
83
119
  console.log('\n No cache to clean or error occurred.\n');
84
120
  }
85
121
  } else {
86
- console.log(`
87
- mdboard cache — Manage remote source cache
122
+ console.log('\n mdboard cache — Manage remote source cache\n\n Subcommands:\n mdboard cache list List cached remote repos\n mdboard cache clean Remove all cached repos\n');
123
+ }
124
+ }
88
125
 
89
- Subcommands:
90
- mdboard cache list List cached remote repos
91
- mdboard cache clean Remove all cached repos
92
- `);
126
+ // --- History handler ---
127
+
128
+ function handleHistory() {
129
+ const subCmd = args[1];
130
+ const { readHistory, pruneHistory } = require('./src/core/history');
131
+
132
+ if (subCmd === 'list') {
133
+ const entries = readHistory();
134
+ if (entries.length === 0) {
135
+ console.log('\n No projects in history.\n');
136
+ } else {
137
+ console.log('\n Project history (' + entries.length + '):\n');
138
+ const fs = require('fs');
139
+ entries.forEach(function(e) {
140
+ const exists = fs.existsSync(e.path);
141
+ const marker = exists ? ' ' : '✗ ';
142
+ console.log(' ' + marker + e.name + ' ' + e.path);
143
+ });
144
+ console.log('');
145
+ }
146
+ } else if (subCmd === 'clean') {
147
+ const { removed, kept } = pruneHistory();
148
+ if (removed.length === 0) {
149
+ console.log('\n History is clean — all entries point to existing directories.\n');
150
+ } else {
151
+ console.log('\n Removed ' + removed.length + ' stale entr' + (removed.length === 1 ? 'y' : 'ies') + ':\n');
152
+ removed.forEach(function(p) { console.log(' ✗ ' + p); });
153
+ console.log('\n ' + kept + ' entr' + (kept === 1 ? 'y' : 'ies') + ' remaining.\n');
154
+ }
155
+ } else {
156
+ console.log('\n mdboard history — Manage project switch history\n\n Subcommands:\n mdboard history list List all projects in history\n mdboard history clean Remove entries with missing directories\n');
93
157
  }
94
- process.exit(0);
95
158
  }
96
159
 
160
+ // --- Help ---
161
+
97
162
  function printHelp() {
98
- console.log(`
99
- mdboard Git-based project management dashboard
100
-
101
- Usage:
102
- mdboard Start the dashboard server
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
113
- mdboard --version Print version
114
- mdboard --help Show this help
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
-
124
- Server options:
125
- --project <path> Workspace root directory (default: cwd)
126
- --port <number> Server port (default: 3333)
127
- --config <path> Path to mdboard.json config file
128
- --workspace <path> Path to workspace.json
129
- `);
163
+ // Load config to generate dynamic examples
164
+ let entityExamples = '';
165
+ try {
166
+ const configEngine = require('./src/core/config');
167
+ const cfg = configEngine.loadConfig(process.cwd(), process.env.MDBOARD_CONFIG);
168
+ const types = configEngine.getEntityTypes(cfg);
169
+
170
+ if (types.length > 0) {
171
+ const examples = [];
172
+ for (const type of types) {
173
+ const entity = configEngine.getEntity(cfg, type);
174
+ const ancestors = configEngine.getAncestors(cfg, type);
175
+ let example = ' mdboard create ' + type + ' "My ' + entity.singular + '"';
176
+ for (const anc of ancestors) {
177
+ example += ' --' + anc.replace(/_/g, '-') + ' <slug>';
178
+ }
179
+ examples.push(example);
180
+ }
181
+ entityExamples = '\n CRUD examples (from ' + cfg._preset + ' preset):\n' + examples.join('\n') + '\n mdboard update task TASK-001 --status done\n mdboard delete task TASK-001\n mdboard list task\n';
182
+ }
183
+ } catch (e) {
184
+ entityExamples = '\n CRUD examples:\n mdboard create <entity> "title" [--flags]\n mdboard update <entity> <id> --field value\n mdboard delete <entity> <id>\n mdboard list <entity>\n';
185
+ }
186
+
187
+ console.log('\n mdboard — Git-based project management dashboard\n\n Usage:\n mdboard Start the dashboard server\n mdboard init [name] Scaffold a new workspace\n mdboard create <entity> Create an entity\n mdboard update <entity> Update an entity\n mdboard delete <entity> Delete an entity\n mdboard list <entity> List entities\n mdboard status Generate status report\n mdboard preset Create & manage presets (scrum, kanban)\n mdboard config Setup preferences & AI skill\n mdboard skill Install AI skill to IDE/agent\n mdboard history list|clean Manage project switch history\n mdboard cache list|clean Manage remote source cache\n mdboard --version Print version\n mdboard --help Show this help\n' + entityExamples + '\n Options:\n --project <path> Workspace root (default: cwd)\n --preset <name> Methodology preset (shape-up, scrum, kanban)\n --config <path> Path to config directory\n --port <number> Server port (default: 3333)\n --workspace <path> Path to workspace.json\n');
130
188
  }