@suss/adapter-ruby 0.33.1 → 0.34.1
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.
- package/README.md +10 -10
- package/dist/index.cjs +7119 -2004
- package/dist/index.d.cts +807 -406
- package/dist/index.d.ts +807 -406
- package/dist/index.js +7137 -1962
- package/grammar/README.md +23 -21
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Read a Ruby codebase with [suss](https://github.com/nimbuscloud-ai/suss).
|
|
4
4
|
|
|
5
|
-
suss reads both sides of every call in a repository and
|
|
5
|
+
suss reads both sides of every call in a repository and reports where the two disagree. A client might ask for a field the route stopped returning, a status might go unhandled, or a queue might have no consumer. It reads the code itself, without a model or network access. This package reads Ruby. It parses with tree-sitter, resolves a constant the way Ruby does, and records what each Rails action and each graphql-ruby field returns.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -15,30 +15,30 @@ The adapter ships inside the CLI, so there is nothing else to install.
|
|
|
15
15
|
## Read a Rails app
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npx suss extract --lang ruby -f rails -f activerecord -o summaries/ruby.json
|
|
19
|
-
npx suss check --dir summaries/
|
|
18
|
+
npx @suss/cli extract --lang ruby -f rails -f activerecord -o summaries/ruby.json
|
|
19
|
+
npx @suss/cli check --dir summaries/
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
`suss init` reads your Gemfile and writes those two commands out for your own project.
|
|
23
23
|
|
|
24
24
|
## What it reads
|
|
25
25
|
|
|
26
|
-
- Rails controller actions, bound to the method and path `config/routes.rb` gives each one
|
|
27
|
-
- graphql-ruby's class-based field DSL, including `mutation:` and `resolver:` wiring
|
|
28
|
-
- ActiveRecord calls, what a file reads from the environment, and what a body calls out to
|
|
29
|
-
- SQL a project wrote itself and
|
|
26
|
+
- Rails controller actions, bound to the method and path that `config/routes.rb` gives each one. It records every status an action can respond with, and the `before_action` filters that run before it.
|
|
27
|
+
- graphql-ruby's class-based field DSL, including `mutation:` and `resolver:` wiring. It finds the method behind a field wherever the class's ancestry defines it.
|
|
28
|
+
- ActiveRecord calls, what a file reads from the environment, and what a body calls out to. These are recorded as facts that the checker's rules run over.
|
|
29
|
+
- SQL a project wrote itself and passed to a database client. `@suss/sql` parses it into the tables it touches.
|
|
30
30
|
|
|
31
31
|
How each of those is decided, and where it stops: [how the Ruby adapter reads a project](./DESIGN.md).
|
|
32
32
|
|
|
33
33
|
## Reading a value
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
Code outside the facility never reads a node's text to find out what a value is. `values/evaluator.ts` is the evaluator. `evaluatedValue` runs the statements ahead of an expression and returns what it comes to. `stringValueOf` returns the string when the value settles to one, so a path built by interpolation or out of a constant reads the same as one written out. `facts/resolve.ts` works out where a name came from, with `writtenValueOf` and `resolvedFunctions`. The literal readers in `ast.ts` (`stringLiteralValue`, `symbolValue`, `booleanLiteralValue`) are for the places where a literal is written out in the source. When one of them cannot read a spelling, add the case to the evaluator's lowering or to the resolution rules. `npm run check:readers` at the repo root fails on a reader written beside a call site instead. [`design/docs-internal/style.md#reading-a-value`](../../../design/docs-internal/style.md#reading-a-value) has the rule.
|
|
36
36
|
|
|
37
37
|
## Where it fits
|
|
38
38
|
|
|
39
|
-
It depends on `@suss/extractor`, `@suss/behavioral-ir`, `@suss/datalog` and `web-tree-sitter`. The `rails` and `graphql-ruby` packs consume its `RubyPack` contract. Nothing
|
|
39
|
+
It depends on `@suss/extractor`, `@suss/behavioral-ir`, `@suss/datalog` and `web-tree-sitter`. The `rails` and `graphql-ruby` packs consume its `RubyPack` contract. Nothing in this package hardcodes what a particular library's classes or base classes are called. The packs declare those.
|
|
40
40
|
|
|
41
|
-
`grammar/tree-sitter-ruby.wasm` is a checked-in binary,
|
|
41
|
+
`grammar/tree-sitter-ruby.wasm` is a checked-in binary, and the build does not produce it. [Where it comes from](./grammar/README.md).
|
|
42
42
|
|
|
43
43
|
## More
|
|
44
44
|
|