knoxis-helper 1.4.9 → 1.4.11

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