@hanzlaa/rcode 2.3.1 → 2.3.2

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 (90) hide show
  1. package/CLAUDE.md +15 -0
  2. package/README.md +8 -8
  3. package/cli/postinstall.js +4 -4
  4. package/package.json +2 -2
  5. package/rihal/agents/rihal-executor.md +1 -0
  6. package/rihal/agents/rihal-phase-researcher.md +1 -0
  7. package/rihal/agents/rihal-planner.md +2 -1
  8. package/rihal/brain/best-practices/no-theoretical-suggestions.md +56 -0
  9. package/rihal/commands/add-phase.md +2 -2
  10. package/rihal/commands/cleanup.md +2 -2
  11. package/rihal/commands/pr-branch.md +2 -2
  12. package/rihal/commands/remove-phase.md +2 -2
  13. package/rihal/commands/research-phase.md +2 -2
  14. package/rihal/commands/ship.md +15 -3
  15. package/rihal/commands/validate-phase.md +1 -1
  16. package/rihal/commands/verify-phase.md +2 -2
  17. package/rihal/skills/actions/1-analysis/research/rihal-domain-research/SKILL.md +11 -0
  18. package/rihal/skills/actions/1-analysis/research/rihal-market-research/SKILL.md +11 -0
  19. package/rihal/skills/actions/1-analysis/research/rihal-technical-research/SKILL.md +13 -0
  20. package/rihal/skills/actions/1-analysis/rihal-document-project/SKILL.md +11 -0
  21. package/rihal/skills/actions/1-analysis/rihal-prfaq/SKILL.md +2 -0
  22. package/rihal/skills/actions/1-analysis/rihal-product-brief/SKILL.md +7 -0
  23. package/rihal/skills/actions/2-plan/rihal-create-epics-and-stories/SKILL.md +12 -0
  24. package/rihal/skills/actions/2-plan/rihal-create-milestone/SKILL.md +18 -0
  25. package/rihal/skills/actions/2-plan/rihal-create-prd/SKILL.md +13 -0
  26. package/rihal/skills/actions/2-plan/rihal-create-story/SKILL.md +12 -0
  27. package/rihal/skills/actions/2-plan/rihal-create-ux-design/SKILL.md +12 -0
  28. package/rihal/skills/actions/2-plan/rihal-edit-prd/SKILL.md +11 -0
  29. package/rihal/skills/actions/2-plan/rihal-frontend-design/SKILL.md +13 -0
  30. package/rihal/skills/actions/2-plan/rihal-validate-prd/SKILL.md +12 -0
  31. package/rihal/skills/actions/3-solutioning/rihal-check-implementation-readiness/SKILL.md +12 -0
  32. package/rihal/skills/actions/3-solutioning/rihal-create-architecture/SKILL.md +14 -0
  33. package/rihal/skills/actions/3-solutioning/rihal-generate-project-context/SKILL.md +12 -0
  34. package/rihal/skills/actions/4-implementation/rihal-checkpoint-preview/SKILL.md +6 -0
  35. package/rihal/skills/actions/4-implementation/rihal-code-review/SKILL.md +12 -0
  36. package/rihal/skills/actions/4-implementation/rihal-correct-course/SKILL.md +13 -0
  37. package/rihal/skills/actions/4-implementation/rihal-dev-story/SKILL.md +12 -0
  38. package/rihal/skills/actions/4-implementation/rihal-qa-generate-e2e-tests/SKILL.md +12 -0
  39. package/rihal/skills/actions/4-implementation/rihal-retrospective/SKILL.md +11 -0
  40. package/rihal/skills/actions/4-implementation/rihal-scaffold-project/SKILL.md +10 -0
  41. package/rihal/skills/actions/4-implementation/rihal-sprint-planning/SKILL.md +11 -0
  42. package/rihal/skills/actions/4-implementation/rihal-sprint-status/SKILL.md +10 -0
  43. package/rihal/skills/agents/ahmed-hassani-director/SKILL.md +13 -1
  44. package/rihal/skills/agents/fatima-qa/SKILL.md +14 -1
  45. package/rihal/skills/agents/haitham-frontend/SKILL.md +15 -1
  46. package/rihal/skills/agents/hanzla-engineer/SKILL.md +14 -1
  47. package/rihal/skills/agents/hussain-pm/SKILL.md +14 -1
  48. package/rihal/skills/agents/hussain-sm/SKILL.md +14 -1
  49. package/rihal/skills/agents/layla-designer/SKILL.md +15 -1
  50. package/rihal/skills/agents/majlis-council/SKILL.md +14 -1
  51. package/rihal/skills/agents/mariam-marketing/SKILL.md +15 -1
  52. package/rihal/skills/agents/nasser-eng-manager/SKILL.md +14 -1
  53. package/rihal/skills/agents/noor-writer/SKILL.md +14 -1
  54. package/rihal/skills/agents/raees-orchestrator/SKILL.md +13 -1
  55. package/rihal/skills/agents/sadiq-analyst/SKILL.md +15 -1
  56. package/rihal/skills/agents/waleed-architect/SKILL.md +16 -1
  57. package/rihal/skills/agents/yousef-backend/SKILL.md +16 -1
  58. package/rihal/skills/agents/zahra-branding/SKILL.md +15 -1
  59. package/rihal/skills/agents/zayd-ml/SKILL.md +17 -1
  60. package/rihal/skills/core/rihal-advanced-elicitation/SKILL.md +12 -0
  61. package/rihal/skills/core/rihal-brainstorming/SKILL.md +16 -0
  62. package/rihal/skills/core/rihal-clone-website/SKILL.md +21 -0
  63. package/rihal/skills/core/rihal-distillator/SKILL.md +8 -0
  64. package/rihal/skills/core/rihal-editorial-review-prose/SKILL.md +12 -0
  65. package/rihal/skills/core/rihal-editorial-review-structure/SKILL.md +18 -0
  66. package/rihal/skills/core/rihal-help/SKILL.md +12 -0
  67. package/rihal/skills/core/rihal-index-docs/SKILL.md +18 -0
  68. package/rihal/skills/core/rihal-init/SKILL.md +8 -0
  69. package/rihal/skills/core/rihal-party-mode/SKILL.md +14 -0
  70. package/rihal/skills/core/rihal-review-adversarial-general/SKILL.md +12 -0
  71. package/rihal/skills/core/rihal-review-edge-case-hunter/SKILL.md +18 -0
  72. package/rihal/skills/core/rihal-shard-doc/SKILL.md +18 -0
  73. package/rihal/team.yaml +205 -0
  74. package/rihal/workflows/autonomous.md +2 -2
  75. package/rihal/workflows/checkpoint-preview.md +1 -1
  76. package/rihal/workflows/document-project.md +1 -1
  77. package/rihal/workflows/help.md +1 -1
  78. package/rihal/workflows/prfaq.md +1 -1
  79. package/rihal/workflows/settings.md +18 -17
  80. package/rihal/workflows/ship.md +31 -1
  81. package/rihal/workflows/sprint-planning.md +2 -2
  82. package/server/dashboard.js +34 -575
  83. package/server/lib/api.js +123 -0
  84. package/server/lib/html/client.js +969 -0
  85. package/server/lib/html/css.js +416 -0
  86. package/server/lib/html/shell.js +230 -0
  87. package/server/lib/scanner.js +142 -0
  88. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/SKILL.md +0 -148
  89. package/rihal/skills/core/rihal-advanced-elicitation/rihal-advanced-elicitation/methods.csv +0 -51
  90. package/rihal/skills/core/rihal-shard-doc/rihal-shard-doc/SKILL.md +0 -122
@@ -0,0 +1,123 @@
1
+ /**
2
+ * API route handlers — all /api/* endpoints.
3
+ */
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+ const { scanState } = require('./scanner');
7
+
8
+ function handleApiState(req, res, rihalDir) {
9
+ const state = scanState(rihalDir);
10
+ res.writeHead(200, { 'Content-Type': 'application/json' });
11
+ res.end(JSON.stringify(state, null, 2));
12
+ }
13
+
14
+ function handleApiFiles(req, res, projectRoot) {
15
+ const PLANNING_DIR = path.join(projectRoot, '.planning');
16
+ const ARTIFACT_DIRS = ['phases', 'brainstorms', 'council-sessions', 'summaries', 'memory'];
17
+ const ROOT_FILES = ['ROADMAP.md', 'STATE.md', 'PROJECT.md'];
18
+
19
+ const groups = [];
20
+
21
+ const rootFiles = ROOT_FILES
22
+ .filter(f => { try { fs.accessSync(path.join(PLANNING_DIR, f)); return true; } catch { return false; } })
23
+ .map(f => ({ label: f.replace('.md', ''), path: '.planning/' + f }));
24
+ if (rootFiles.length) groups.push({ group: 'Overview', files: rootFiles });
25
+
26
+ for (const dir of ARTIFACT_DIRS) {
27
+ const full = path.join(PLANNING_DIR, dir);
28
+ const files = [];
29
+ function walkArtifacts(d, prefix, depth) {
30
+ if (depth > 3) return;
31
+ let entries;
32
+ try { entries = fs.readdirSync(d, { withFileTypes: true }); } catch { return; }
33
+ for (const e of entries) {
34
+ if (e.name.startsWith('.')) continue;
35
+ const rel = prefix + '/' + e.name;
36
+ if (e.isDirectory()) walkArtifacts(path.join(d, e.name), rel, depth + 1);
37
+ else if (e.isFile() && e.name.endsWith('.md')) {
38
+ const parentDir = prefix.split('/').filter(Boolean).pop() || '';
39
+ const parentLabel = parentDir
40
+ ? parentDir.replace(/^\d+-/, '').replace(/-/g, ' ') + ' › '
41
+ : '';
42
+ const base = e.name.replace('.md', '');
43
+ const sprintMatch = base.match(/^\d{2}-(\d{2})-([A-Z]+)$/);
44
+ const phaseMatch = base.match(/^(\d{2})-([A-Z]+)$/);
45
+ const dateMatch = base.match(/^\d{4}-\d{2}-\d{2}-(.+)$/);
46
+ let fileLabel;
47
+ if (sprintMatch) {
48
+ fileLabel = sprintMatch[2].charAt(0) + sprintMatch[2].slice(1).toLowerCase() + ' ' + parseInt(sprintMatch[1], 10);
49
+ } else if (phaseMatch) {
50
+ fileLabel = phaseMatch[2].charAt(0) + phaseMatch[2].slice(1).toLowerCase() + ' ' + parseInt(phaseMatch[1], 10);
51
+ } else if (dateMatch) {
52
+ fileLabel = dateMatch[1].replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
53
+ } else if (base === base.toUpperCase() && /^[A-Z_-]+$/.test(base)) {
54
+ fileLabel = base.charAt(0) + base.slice(1).toLowerCase();
55
+ } else {
56
+ fileLabel = base.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
57
+ }
58
+ files.push({ label: parentLabel + fileLabel, path: '.planning/' + dir + rel });
59
+ }
60
+ }
61
+ }
62
+ walkArtifacts(full, '', 0);
63
+ if (files.length) {
64
+ const groupLabel = dir.charAt(0).toUpperCase() + dir.slice(1).replace(/-/g, ' ');
65
+ groups.push({ group: groupLabel, files });
66
+ }
67
+ }
68
+
69
+ res.writeHead(200, { 'Content-Type': 'application/json' });
70
+ res.end(JSON.stringify(groups));
71
+ }
72
+
73
+ function handleApiFile(req, res, projectRoot) {
74
+ const url = req.url || '';
75
+ const params = new URLSearchParams(url.split('?')[1] || '');
76
+ const relPath = params.get('path') || '';
77
+ if (!relPath) {
78
+ res.writeHead(400); res.end('Missing path parameter'); return;
79
+ }
80
+ // Fix #321: decode URL-encoded characters before resolving
81
+ const decoded = decodeURIComponent(relPath);
82
+ const resolved = path.resolve(projectRoot, decoded.replace(/^\//, ''));
83
+ if (!resolved.startsWith(projectRoot + path.sep) && resolved !== projectRoot) {
84
+ res.writeHead(403); res.end('Forbidden'); return;
85
+ }
86
+ if (!resolved.endsWith('.md')) {
87
+ res.writeHead(403); res.end('Forbidden: only .md files'); return;
88
+ }
89
+ let content;
90
+ try { content = fs.readFileSync(resolved, 'utf8'); }
91
+ catch { res.writeHead(404); res.end('File not found'); return; }
92
+ res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' });
93
+ res.end(content);
94
+ }
95
+
96
+ // Fix #265: hierarchy endpoint
97
+ function handleApiHierarchy(req, res, rihalDir) {
98
+ const state = scanState(rihalDir);
99
+ const phases = state.raw?.phases || [];
100
+ const hierarchy = {
101
+ milestone: state.milestone || 'M1',
102
+ phases: phases.map(p => ({
103
+ id: p.id,
104
+ name: p.name,
105
+ status: p.status,
106
+ sprints: (p.sprints || []).map(s => ({
107
+ id: s.id,
108
+ goal: s.goal,
109
+ status: s.status,
110
+ stories: (s.stories || []).map(t => ({
111
+ id: t.id,
112
+ title: t.title,
113
+ status: t.status,
114
+ points: t.points || null,
115
+ })),
116
+ })),
117
+ })),
118
+ };
119
+ res.writeHead(200, { 'Content-Type': 'application/json' });
120
+ res.end(JSON.stringify(hierarchy, null, 2));
121
+ }
122
+
123
+ module.exports = { handleApiState, handleApiFiles, handleApiFile, handleApiHierarchy };