@tinkerlandai/indiana-cli 0.0.0-stage → 0.3.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.
@@ -0,0 +1,53 @@
1
+ // src/code-references/scanner.mjs
2
+ import ts from "typescript";
3
+ function matchesPath(file, patterns) {
4
+ return patterns.some((pattern) => {
5
+ let regex = "^";
6
+ for (let i = 0; i < pattern.length; i++) {
7
+ if (pattern.slice(i, i + 3) === "**/") {
8
+ regex += "(?:.*/)?";
9
+ i += 2;
10
+ } else if (pattern.slice(i, i + 2) === "**") {
11
+ regex += ".*";
12
+ i++;
13
+ } else if (pattern[i] === "*") regex += "[^/]*";
14
+ else if (pattern[i] === "?") regex += "[^/]";
15
+ else regex += pattern[i].replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16
+ }
17
+ return new RegExp(regex + "$").test(file);
18
+ });
19
+ }
20
+ function scanSource(source, filePath, keys, methods) {
21
+ const file = ts.createSourceFile(
22
+ filePath,
23
+ source,
24
+ ts.ScriptTarget.Latest,
25
+ true
26
+ );
27
+ if (file.parseDiagnostics.length)
28
+ throw new Error("Source syntax cannot be parsed");
29
+ const refs = new Map([...keys].map((key) => [key, []]));
30
+ let unresolvedCalls = 0;
31
+ function visit(node) {
32
+ if (ts.isCallExpression(node)) {
33
+ const name = ts.isPropertyAccessExpression(node.expression) ? node.expression.name.text : ts.isElementAccessExpression(node.expression) && ts.isStringLiteralLike(node.expression.argumentExpression) ? node.expression.argumentExpression.text : ts.isIdentifier(node.expression) ? node.expression.text : "";
34
+ if (methods.has(name)) {
35
+ const argument = node.arguments[0];
36
+ if (argument && ts.isStringLiteralLike(argument)) {
37
+ if (refs.has(argument.text))
38
+ refs.get(argument.text).push({
39
+ filePath,
40
+ startingLineNumber: file.getLineAndCharacterOfPosition(argument.getStart(file)).line + 1
41
+ });
42
+ } else unresolvedCalls++;
43
+ }
44
+ }
45
+ ts.forEachChild(node, visit);
46
+ }
47
+ visit(file);
48
+ return { refs, unresolvedCalls };
49
+ }
50
+ export {
51
+ matchesPath,
52
+ scanSource
53
+ };
package/package.json CHANGED
@@ -1,6 +1,37 @@
1
1
  {
2
2
  "name": "@tinkerlandai/indiana-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.11",
4
+ "description": "Indiana management CLI",
5
+ "type": "module",
6
+ "license": "UNLICENSED",
7
+ "engines": {
8
+ "node": ">=22"
9
+ },
10
+ "bin": {
11
+ "indiana": "./dist/main.js"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "CHANGELOG.md"
17
+ ],
18
+ "dependencies": {
19
+ "css-tree": "^3.2.1",
20
+ "@napi-rs/keyring": "^2.1.0",
21
+ "commander": "14.0.3",
22
+ "open": "^11.0.4",
23
+ "openid-client": "^6.8.8",
24
+ "typescript": "^5.9.3",
25
+ "zod": "4.6.5"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/tinkerlandai/Indiana.git",
30
+ "directory": "packages/cli"
31
+ },
32
+ "homepage": "https://tinker.cash/docs/cli",
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "registry": "https://registry.npmjs.org"
36
+ }
37
+ }