am-i-done 0.6.0 → 0.7.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.
package/README.md CHANGED
@@ -159,7 +159,8 @@ A `check` rule returns `ctx.checked()` when it inspected the file and `ctx.skipp
159
159
  was out of scope. Its return type is a brand only the engine can mint, so a bare `return` does not
160
160
  compile.
161
161
 
162
- **Syntax trees.** A check rule that sets `ast: true` can call `ctx.ast()` for the file's tree, in
162
+ **Syntax trees.** A check rule that sets `ast: true` can call `ctx.ast()` for the file's tree (or `ctx.ast(path)` for another loaded file's, to follow an
163
+ import or a re-export), in
163
164
  [TSESTree](https://typescript-eslint.io/packages/typescript-estree/) form (the ESTree dialect
164
165
  typescript-eslint defines), with `range`, `loc` and `parent` on every node and the comments on the
165
166
  program. It is parsed once per file and shared by every rule. The parser is TypeScript (through
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "am-i-done",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "A definition of done for agentic projects: one command that says whether the work is finished.",
5
5
  "license": "MIT",
6
6
  "author": "theshadow27 (https://github.com/theshadow27)",
@@ -125,7 +125,12 @@ export function evaluate(rule: Rule, file: FileMeta, ws: Workspace): Evaluation
125
125
  violated,
126
126
  checked: mintChecked,
127
127
  skipped: mintSkipped,
128
- ast: () => ws.ast(file),
128
+ ast: (path?: string) => {
129
+ if (path === undefined) return ws.ast(file);
130
+ const other = ws.files.get(path);
131
+ if (other === undefined) throw new Error(`ctx.ast("${path}"): not a loaded file`);
132
+ return ws.ast(other);
133
+ },
129
134
  graph: () => ws.graph(),
130
135
  };
131
136
  let checked: boolean;
@@ -47,8 +47,12 @@ export interface RuleContext {
47
47
  checked(): Verdict;
48
48
  /** This file is out of scope. Claims no work. */
49
49
  skipped(): Verdict;
50
- /** The file's syntax tree (TSESTree), parsed once and shared by every rule. Needs `ast: true`. */
51
- ast(): Ast;
50
+ /**
51
+ * A file's syntax tree (TSESTree), parsed once and shared by every rule. Needs `ast: true`. With
52
+ * a path (relative to the root, as in `files`), another loaded file's: for a rule that follows an
53
+ * import or a re-export. Throws for a path that is not loaded.
54
+ */
55
+ ast(path?: string): Ast;
52
56
  /** The project's import graph, built once per run. */
53
57
  graph(): ImportGraph;
54
58
  }
@@ -9,21 +9,21 @@ rerun = "diagnose" # a failure is run again to see if it repeats, and fai
9
9
  [stages]
10
10
  recommended = true # bun-version, typecheck, lint, rules, test: each where its tool is set up
11
11
  dirs = ["scripts/stages"] # this project's *.stage.ts
12
- # skip = [{ id = "lint", reason = "<why>, until #123" }]
12
+ # skip = [{ id = "lint", reason = "<why>, until #<issue>" }]
13
13
 
14
14
  [rules]
15
15
  recommended = true # the built-in rules (doing-it-wrong --list)
16
16
  dirs = ["scripts/rules"] # this project's *.rule.ts, with fixtures in scripts/rules/fixtures/
17
- # skip = [{ id = "no-as-any", reason = "<why>, until #123" }]
17
+ # skip = [{ id = "no-as-any", reason = "<why>, until #<issue>" }]
18
18
 
19
19
  [suppression]
20
- require_issue = true # every waiver cites an issue: // doing-it-wrong-ignore <rule>: <reason> (#123)
20
+ require_issue = true # every waiver cites an issue: // doing-it-wrong-ignore <rule>: <reason> (#<issue>)
21
21
  # A file that cannot carry that comment (generated, JSON) is waived here instead:
22
22
  # [[suppression.waive]]
23
23
  # rule = "<id>"
24
24
  # file = "<path>"
25
25
  # match = "<text on the line>"
26
- # reason = "<why> (#123)"
26
+ # reason = "<why> (#<issue>)"
27
27
 
28
28
  [cache]
29
29
  skip = true # a local rerun of an unchanged tree is skipped; never in CI