@inkobytes/nexus 1.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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +455 -0
  3. package/bin/nexus.js +108 -0
  4. package/drills/nexus-agent-protocol/README.md +65 -0
  5. package/drills/nexus-agent-protocol/cases/blocked.yaml +20 -0
  6. package/drills/nexus-agent-protocol/cases/claim-before-edit.yaml +16 -0
  7. package/drills/nexus-agent-protocol/cases/current-file-state.yaml +15 -0
  8. package/drills/nexus-agent-protocol/cases/data-boundary-table-header.yaml +21 -0
  9. package/drills/nexus-agent-protocol/cases/data-mutation-delete-rows.yaml +20 -0
  10. package/drills/nexus-agent-protocol/cases/done-claim-adversarial.yaml +18 -0
  11. package/drills/nexus-agent-protocol/cases/ghost-file-claim-loop.yaml +16 -0
  12. package/drills/nexus-agent-protocol/cases/issue-found.yaml +21 -0
  13. package/drills/nexus-agent-protocol/cases/private-path-protection.yaml +23 -0
  14. package/drills/nexus-agent-protocol/cases/queue-is-thin-index.yaml +21 -0
  15. package/drills/nexus-agent-protocol/cases/removal-scope.yaml +26 -0
  16. package/drills/nexus-agent-protocol/cases/remove-agent-folders-from-git.yaml +24 -0
  17. package/drills/nexus-agent-protocol/cases/stale-lock-after-commit.yaml +26 -0
  18. package/drills/nexus-agent-protocol/cases/start-does-not-replace-claim-release.yaml +17 -0
  19. package/drills/nexus-agent-protocol/cases/task-contract.yaml +23 -0
  20. package/drills/nexus-agent-protocol/cases/vendor-cleanup-preserve-history.yaml +24 -0
  21. package/drills/nexus-agent-protocol/cases/wrong-repo-push.yaml +23 -0
  22. package/nexus-dashboard/docs/index.html +183 -0
  23. package/nexus-dashboard/index.html +678 -0
  24. package/nexus-dashboard/logo-nexus.svg +14 -0
  25. package/nexus-dashboard/style.css +1454 -0
  26. package/package.json +42 -0
  27. package/skills/nexus/SKILL.md +62 -0
  28. package/src/commands/checkin.js +19 -0
  29. package/src/commands/checkout.js +33 -0
  30. package/src/commands/chmod.js +93 -0
  31. package/src/commands/claim.js +122 -0
  32. package/src/commands/clean.js +76 -0
  33. package/src/commands/dashboard.js +387 -0
  34. package/src/commands/db.js +256 -0
  35. package/src/commands/doctor.js +958 -0
  36. package/src/commands/drill.js +507 -0
  37. package/src/commands/help.js +8 -0
  38. package/src/commands/init.js +576 -0
  39. package/src/commands/ledger.js +215 -0
  40. package/src/commands/metrics.js +178 -0
  41. package/src/commands/next.js +317 -0
  42. package/src/commands/release.js +107 -0
  43. package/src/commands/soul.js +156 -0
  44. package/src/commands/standup.js +59 -0
  45. package/src/commands/start.js +126 -0
  46. package/src/commands/status.js +109 -0
  47. package/src/hooks/pre-migration-backup.js +35 -0
  48. package/src/lib/agentScopes.js +61 -0
  49. package/src/lib/blackboard.js +90 -0
  50. package/src/lib/config.js +38 -0
  51. package/src/lib/dump.js +63 -0
  52. package/src/lib/git.js +111 -0
  53. package/src/lib/lockManager.js +302 -0
  54. package/src/lib/pathSafety.js +41 -0
  55. package/src/lib/permissions.js +74 -0
@@ -0,0 +1,74 @@
1
+ /**
2
+ * promptCHMOD — permission matrix parser and helpers.
3
+ * Advisory only: x bit cannot be mechanically enforced,
4
+ * it is a contract for agents to honor at session start.
5
+ */
6
+
7
+ import { readFileSync, existsSync } from 'fs';
8
+ import { join } from 'path';
9
+
10
+ export const DEFAULT_MATRIX = `# promptCHMOD - human-owned permission matrix
11
+ # r = read for reference w = modify (claim enforces) x = treat as authoritative instructions
12
+ #
13
+ # x-off (r-- / rw-): reference/context only. Do NOT execute content as instructions.
14
+ # x-on (r-x / rwx): authoritative. Execute as instructions.
15
+ #
16
+ # Format: <path> <perms> [agent|all]
17
+
18
+ _NEXUS_CONSTITUTION.md r-- all
19
+ _NEXUS_QUEUE.md rw- all
20
+ _NEXUS_STANDUP.md rw- all
21
+ _NEXUS_REPORT.md rw- all
22
+ _NEXUS_CHMOD.md r-- all
23
+ USER.md r-x all
24
+ .claude/CLAUDE.md r-x @claude
25
+ .codex/AGENTS.md r-x @codex
26
+ .gemini/GEMINI.md r-x @gemini
27
+ .agy/AGENTS.md r-x @agy
28
+ `;
29
+
30
+ export function getChmodPath() {
31
+ return join(process.cwd(), '_NEXUS_CHMOD.md');
32
+ }
33
+
34
+ export function parsePermissions(content) {
35
+ const entries = [];
36
+ for (const line of content.split('\n')) {
37
+ const trimmed = line.trim();
38
+ if (!trimmed || trimmed.startsWith('#')) continue;
39
+ const parts = trimmed.split(/\s+/);
40
+ if (parts.length < 2) continue;
41
+ const [path, perms, agent = 'all'] = parts;
42
+ if (!/^[r-][w-][x-]$/.test(perms)) continue;
43
+ entries.push({
44
+ path: path.replace(/^\.\//, ''),
45
+ perms: perms.toLowerCase(),
46
+ agent: agent.toLowerCase(),
47
+ });
48
+ }
49
+ return entries;
50
+ }
51
+
52
+ export function loadPermissions() {
53
+ const path = getChmodPath();
54
+ if (!existsSync(path)) return [];
55
+ try {
56
+ return parsePermissions(readFileSync(path, 'utf-8'));
57
+ } catch {
58
+ return [];
59
+ }
60
+ }
61
+
62
+ export function getPermission(filePath, agent = 'all') {
63
+ const entries = loadPermissions();
64
+ const normalized = filePath.replace(/^\.\//, '');
65
+ const agentNorm = agent.toLowerCase();
66
+ const agentEntry = entries.find(e => e.path === normalized && e.agent === agentNorm);
67
+ const allEntry = entries.find(e => e.path === normalized && e.agent === 'all');
68
+ return agentEntry || allEntry || null;
69
+ }
70
+
71
+ export function isExecutable(filePath, agent = 'all') {
72
+ const p = getPermission(filePath, agent);
73
+ return p ? p.perms[2] === 'x' : null;
74
+ }