unitbob 0.1.9 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +14 -7
  2. package/dist/proc.js +59 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -31,13 +31,20 @@ Restart the session so the commands load.
31
31
 
32
32
  ## Full cycle
33
33
 
34
- | Step | With a prompt (just type in chat) | With a command |
35
- |------|-----------------------------------|----------------|
36
- | 1. Build the map | `Build my Unitbob map` | `/unitbob:map` |
37
- | 2. Generate tests | `Generate the guardrail tests` | `/unitbob:suite` |
38
- | 3. Run the checks | `Run the checks` | `/unitbob:check` |
39
- | 4. Fix a red lamp | `Fix guardrail <id>` | `/unitbob:fix <id>` |
40
- | 5. Open the map | `Open my Unitbob map` | `/unitbob:show` |
34
+ Just type it in the chat. There is nothing to memorise and no command to get right.
35
+
36
+ | Step | Say this |
37
+ |------|----------|
38
+ | 1. Build the map | `Build my Unitbob map` |
39
+ | 2. Generate tests | `Generate the guardrail tests` |
40
+ | 3. Run the checks | `Run the checks` |
41
+ | 4. Fix a red lamp | `Fix guardrail <id>` |
42
+ | 5. Open the map | `Open my Unitbob map` |
43
+
44
+ There are also `/unitbob:map`, `/unitbob:suite` and friends, but they work only
45
+ inside a Claude Code terminal, and only in a session started after the plugin was
46
+ installed — in a browser or desktop window they are not recognised at all. The
47
+ phrasings above work everywhere, so they are the ones documented here.
41
48
 
42
49
  ---
43
50
 
package/dist/proc.js CHANGED
@@ -56,20 +56,70 @@ export async function requireGraphify() {
56
56
  `"graphify", needs Python 3.10+), then retry (${err.message}).`);
57
57
  }
58
58
  }
59
+ // Paths that hold no business logic in the stacks unitbob supports — Rails,
60
+ // JS/TS, Python — and that graphify does not already skip (it drops
61
+ // node_modules, venv, dist, build, target, out, __pycache__, and the framework
62
+ // cache and report dirs on its own).
63
+ //
64
+ // Every entry earns its place, because an over-broad pattern fails silently: a
65
+ // subsystem simply never appears on the map and nobody learns why. Measured on
66
+ // one real Rails app (2943 nodes), vendor/ was 1337 of them, app/assets/ 414,
67
+ // db/migrate/ 314 — 70% of the graph, and the busiest nodes in it were `_()`
68
+ // and `$()`. Everything else in that project was already clean: bin/, tmp/,
69
+ // log/ and storage/ produced zero nodes, so they are deliberately not listed.
70
+ //
71
+ // The list stays language-neutral: one project is often Rails and Python at
72
+ // once. Gitignore syntax; graphify merges it with .gitignore, and it can only
73
+ // ever exclude more, never re-include.
74
+ export const GRAPH_NOISE_PATTERNS = [
75
+ '# unitbob: keep the graph about your own business code',
76
+ '.unitbob/',
77
+ // Third-party code committed into the repo. In Rails, `vendor/` is the
78
+ // convention for it, and `app/assets/javascripts/` is where sprockets-era
79
+ // apps dumped libraries — on the measured app that folder was moment.js,
80
+ // datatables.js and jquery.inputmask, against a single node of own code. A
81
+ // modern Rails app keeps its own JS in `app/javascript/`, which stays.
82
+ 'vendor/',
83
+ 'app/assets/javascripts/',
84
+ 'app/assets/builds/',
85
+ 'app/assets/config/',
86
+ 'public/assets/',
87
+ 'public/packs/',
88
+ '*.min.js',
89
+ '*.min.css',
90
+ '*.bundle.js',
91
+ // Generated code: schema history and codegen output. Describes the shape of
92
+ // data, never the behaviour a guardrail could protect.
93
+ 'db/migrate/',
94
+ 'db/schema.rb',
95
+ 'db/structure.sql',
96
+ 'migrations/',
97
+ '__generated__/',
98
+ '*_pb2.py',
99
+ '*_pb2_grpc.py',
100
+ '*_pb.js',
101
+ // Type declarations — a contract for a compiler, with no runtime behaviour.
102
+ '*.d.ts',
103
+ '*.pyi',
104
+ ];
59
105
  export function ensureUnitbobIgnored(projectRoot) {
60
- ensureLine(join(projectRoot, '.gitignore'), '.unitbob/');
61
- ensureLine(join(projectRoot, '.gitignore'), 'graphify-out/');
62
- ensureLine(join(projectRoot, '.graphifyignore'), '.unitbob/');
106
+ // `.graphifyignore` is unitbob's own bookkeeping, like the other two entries —
107
+ // the user never edits it, so it stays out of their commits.
108
+ ensureLines(join(projectRoot, '.gitignore'), ['.unitbob/', 'graphify-out/', '.graphifyignore']);
109
+ ensureLines(join(projectRoot, '.graphifyignore'), GRAPH_NOISE_PATTERNS);
63
110
  }
64
- function ensureLine(path, line) {
111
+ // Appends whichever lines are missing, in one write, leaving the user's own
112
+ // entries (and their order) untouched. Idempotent: a second run adds nothing.
113
+ function ensureLines(path, lines) {
65
114
  let current = '';
66
- if (existsSync(path)) {
115
+ if (existsSync(path))
67
116
  current = readFileSync(path, 'utf8');
68
- if (current.split('\n').some((existing) => existing.trim() === line))
69
- return;
70
- }
117
+ const present = new Set(current.split('\n').map((line) => line.trim()));
118
+ const missing = lines.filter((line) => !present.has(line));
119
+ if (missing.length === 0)
120
+ return;
71
121
  const prefix = current.length > 0 && !current.endsWith('\n') ? '\n' : '';
72
- writeFileSync(path, `${current}${prefix}${line}\n`);
122
+ writeFileSync(path, `${current}${prefix}${missing.join('\n')}\n`);
73
123
  }
74
124
  export async function runGraphifyExtractKeyless(projectRoot) {
75
125
  // Deterministic AST-only graph; no LLM, no API key. `update --force` re-extracts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unitbob",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Unitbob connector — thin local hands for the Unitbob Rails brain. Owns no domain logic: it runs tools, relays bytes over the wire, and prints what the server returns.",
5
5
  "type": "module",
6
6
  "bin": {