knoxis-helper 1.4.8 → 1.4.10

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.
@@ -46,7 +46,51 @@ const ALLOWED_ORIGINS = (process.env.KNOXIS_ALLOWED_ORIGINS || '')
46
46
  .map(origin => origin.trim())
47
47
  .filter(Boolean);
48
48
  // Merge custom origins with trusted ones
49
- const ALL_ALLOWED_ORIGINS = [...new Set([...TRUSTED_ORIGINS, ...ALLOWED_ORIGINS])];
49
+
50
+ /**
51
+ * Collect Maker-related Markdown documents for persistence and syncing.
52
+ * These include backlog, PRD, glossary, product, and strategy files.
53
+ */
54
+ function collectMakerDocs(workspaceDir) {
55
+ try {
56
+ if (!workspaceDir || !fs.existsSync(workspaceDir)) return [];
57
+ const makerFiles = [];
58
+ const candidates = [
59
+ 'BACKLOG.md',
60
+ 'GLOSSARY.md',
61
+ 'PRD.md',
62
+ 'PRODUCT.md',
63
+ 'STRATEGY.md'
64
+ ];
65
+ candidates.forEach(name => {
66
+ const full = path.join(workspaceDir, name);
67
+ if (fs.existsSync(full)) makerFiles.push(full);
68
+ });
69
+ const docsDir = path.join(workspaceDir, 'docs');
70
+ if (fs.existsSync(docsDir)) {
71
+ fs.readdirSync(docsDir).forEach(f => {
72
+ if (f.endsWith('.md')) makerFiles.push(path.join(docsDir, f));
73
+ });
74
+ }
75
+ const mvpDir = path.join(workspaceDir, '.mvp');
76
+ if (fs.existsSync(mvpDir)) {
77
+ const walk = dir => {
78
+ fs.readdirSync(dir, { withFileTypes: true }).forEach(entry => {
79
+ const res = path.join(dir, entry.name);
80
+ if (entry.isDirectory()) walk(res);
81
+ else if (entry.name.endsWith('.md')) makerFiles.push(res);
82
+ });
83
+ };
84
+ walk(mvpDir);
85
+ }
86
+ console.log(`📁 Maker-aware discovery found ${makerFiles.length} planning docs.`);
87
+ return makerFiles;
88
+ } catch (err) {
89
+ console.warn('⚠️ collectMakerDocs failed:', err.message);
90
+ return [];
91
+ }
92
+ }
93
+
50
94
 
51
95
  const serverMeta = { secure: false, port: DEFAULT_PORT };
52
96
 
@@ -636,7 +680,14 @@ async function handleRequest(req, res) {
636
680
  if (body.claudeMdContent && workspace && fs.existsSync(workspace)) {
637
681
  try {
638
682
  fs.writeFileSync(path.join(workspace, 'CLAUDE.md'), body.claudeMdContent, 'utf8');
639
- console.log('📄 Wrote CLAUDE.md (' + body.claudeMdContent.length + ' chars)');
683
+ console.log('📄 Wrote CLAUDE.md (' + body.claudeMdContent.length + ' chars)');
684
+ // Maker-aware discovery integration
685
+ try {
686
+ const makerDocs = collectMakerDocs(workspace);
687
+ console.log(` Maker doc sync: ${makerDocs.length} files found.`);
688
+ } catch (err) {
689
+ console.warn('⚠️ Maker doc sync failed:', err.message);
690
+ }
640
691
  } catch (writeErr) {
641
692
  console.warn('⚠️ Failed to write CLAUDE.md:', writeErr.message);
642
693
  }
@@ -890,6 +941,13 @@ async function handleRequest(req, res) {
890
941
  try {
891
942
  fs.writeFileSync(path.join(workspaceDir, 'CLAUDE.md'), effectiveClaudeMd, 'utf8');
892
943
  console.log(`📄 Wrote CLAUDE.md to ${workspaceDir} (${effectiveClaudeMd.length} chars)`);
944
+ // Maker-aware discovery integration
945
+ try {
946
+ const makerDocs = collectMakerDocs(workspaceDir);
947
+ console.log(` Maker doc sync: ${makerDocs.length} files found.`);
948
+ } catch (err) {
949
+ console.warn('⚠️ Maker doc sync failed:', err.message);
950
+ }
893
951
  } catch (e) {
894
952
  console.warn(`⚠️ Failed to write CLAUDE.md: ${e.message}`);
895
953
  }
@@ -1312,6 +1370,13 @@ function connectRelayWebSocket() {
1312
1370
  try {
1313
1371
  fs.writeFileSync(path.join(wsDir, 'CLAUDE.md'), msg.claudeMdContent, 'utf8');
1314
1372
  console.log(` 📄 Wrote CLAUDE.md (${msg.claudeMdContent.length} chars)`);
1373
+ // Maker-aware discovery integration
1374
+ try {
1375
+ const makerDocs = collectMakerDocs(wsDir);
1376
+ console.log(` Maker doc sync: ${makerDocs.length} files found.`);
1377
+ } catch (err) {
1378
+ console.warn('⚠️ Maker doc sync failed:', err.message);
1379
+ }
1315
1380
  } catch (writeErr) {
1316
1381
  console.warn(` ⚠️ Failed to write CLAUDE.md: ${writeErr.message}`);
1317
1382
  }
@@ -1589,4 +1654,4 @@ server.listen(serverMeta.port, () => {
1589
1654
  console.log('✅ HTTPS enabled - ready for secure connections from deployed frontends');
1590
1655
  console.log('');
1591
1656
  }
1592
- });
1657
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knoxis-helper",
3
- "version": "1.4.8",
3
+ "version": "1.4.10",
4
4
  "description": "Local helper for Knoxis pair programming - connects your machine to Knoxis on qig.ai",
5
5
  "bin": {
6
6
  "knoxis-helper": "./bin/knoxis-helper.js"