Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/axiomcode/hooks/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def rel_of(fp):
fp = str(fp)
for a, b in ((fp, cwd), (os.path.realpath(fp), os.path.realpath(cwd)), (os.path.realpath(fp), cwd), (fp, os.path.realpath(cwd))):
r = os.path.relpath(a, b)
if not r.startswith('..'): return r
if not r.startswith('..'): return r.replace(os.sep, '/') # the index stores '/' on every platform
return fp

def changed(args, timeout=12):
Expand Down
2 changes: 1 addition & 1 deletion plugins/axiomcode/hooks/enrich.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def rel_of(fp):
fp = str(fp)
for a, b in ((fp, cwd), (os.path.realpath(fp), os.path.realpath(cwd)), (os.path.realpath(fp), cwd), (fp, os.path.realpath(cwd))):
r = os.path.relpath(a, b)
if not r.startswith('..'): return r
if not r.startswith('..'): return r.replace(os.sep, '/') # the index stores '/' on every platform
return fp
db = os.path.join(cwd, '.axiomcode', 'out', 'graph.sqlite')
if not os.path.exists(db): sys.exit(0)
Expand Down
2 changes: 1 addition & 1 deletion plugins/axiomcode/hooks/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def main(argv):
if not e.get('text') or 'input' not in e: continue
inp = e['input']
if e.get('as') == 'Read' and inp.get('file_path'):
rel = os.path.relpath(os.path.realpath(inp['file_path']), V_.repo); a0 = int(inp.get('offset') or 1); V_.check_read(e['text'], rel, a0, a0 + int(inp.get('limit') or 100000))
rel = os.path.relpath(os.path.realpath(inp['file_path']), V_.repo).replace(os.sep, '/'); a0 = int(inp.get('offset') or 1); V_.check_read(e['text'], rel, a0, a0 + int(inp.get('limit') or 100000))
elif e.get('as') == 'Grep' and inp.get('pattern'): V_.check_grep(e['text'], re.sub(r'\W.*', '', inp['pattern']))
else:
files = [r[0] for r in V_.q("SELECT DISTINCT file FROM symbols WHERE method_id IS NOT NULL AND kind <> 'module' AND is_test = 0")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class Changed:
def rel(self, f):
f = os.path.realpath(f) if os.path.exists(f) else f
r = os.path.relpath(f, self.repo) if os.path.isabs(f) else f
return r
return r.replace(os.sep, '/')
# ── the two texts of a file ────────────────────────────────────────────────────────────────────────────────
def texts(self, rel, mode, rng):
if mode == 'range':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def main(argv):
elif a == '--seeds' and i + 1 < len(argv): seeds_wanted = int(argv[i + 1]); i += 2
# --in is REPEATABLE and takes a comma-separated list: a change that spans two roots has to be
# askable in one call (#1029). They are combined, never intersected.
elif a == '--in' and i + 1 < len(argv): scopes += [x.strip() for x in argv[i + 1].split(',') if x.strip()]; i += 2
elif a == '--in' and i + 1 < len(argv): scopes += [x.strip().replace('\\', '/') for x in argv[i + 1].split(',') if x.strip()]; i += 2 # the index stores '/'; a Windows user may type a backslash
elif a == '--in-offered': scope_offered = True; i += 1
elif a == '--source': show_source = True; i += 1
elif a == '--json': as_json = True; i += 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def export(repo, page=None):
def rel(p):
a = p if os.path.isabs(p) else os.path.join(src, p)
a = os.path.realpath(a) if os.path.exists(a) else os.path.normpath(a)
r = os.path.relpath(a, repo); return p.lstrip('/') if r.startswith('..') else r
r = os.path.relpath(a, repo).replace(os.sep, '/'); return p.lstrip('/') if r.startswith('..') else r

# ── declarations: types and methods, with the display names the query skill uses when the index is there ──
nodes = {}
Expand Down
4 changes: 2 additions & 2 deletions plugins/axiomcode/skills/axiomcode/scripts/axiomcode-impact
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ class Impact:
with open(fp, 'rb') as fh: head = fh.read(2048)
if b'\0' in head: continue
except OSError: continue
out.append(os.path.relpath(fp, self.g.repo))
out.append(os.path.relpath(fp, self.g.repo).replace(os.sep, '/'))
if len(out) > 4000: break
self._nsf = sorted(out); return self._nsf
def nonsource_hits(self, names):
Expand Down Expand Up @@ -1389,7 +1389,7 @@ def main(argv):
i = args.index(flag); v = conv(args[i + 1]); del args[i:i + 2]
if flag == '--depth': depth = v
elif flag == '--limit': limit = v
elif flag == '--in': IN = v
elif flag == '--in': IN = v.replace('\\', '/') # the index stores '/'; a Windows user may type a backslash
else: kind = v
repo = '.'
if args and os.path.isdir(args[-1]) and (len(args) > 1 or from_text is not None or want_warm): repo = args.pop()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def rel(p):
if not p: return p
a = p if os.path.isabs(p) else os.path.join(SRC, p)
a = os.path.realpath(a) if os.path.exists(a) else os.path.normpath(a)
r = os.path.relpath(a, REPO)
r = os.path.relpath(a, REPO).replace(os.sep, '/') # '/' on every platform: every reader splits on it
return p.lstrip('/') if r.startswith('..') else r
# never DEGRADE: an index built from the IR must not be rebuilt without it (the intermediates are routinely cleaned
# to save disk). If only newer tables are missing, add them empty and keep everything else.
Expand Down
4 changes: 2 additions & 2 deletions plugins/axiomcode/skills/axiomcode/scripts/axiomcode-path
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class G:
if self.has('paths'):
r = self.q("SELECT rel FROM paths WHERE raw = ?", raw)
if r: return r[0]['rel']
return os.path.relpath(raw, self.repo) if os.path.isabs(raw) and raw.startswith(self.repo) else raw
return os.path.relpath(raw, self.repo).replace(os.sep, '/') if os.path.isabs(raw) and raw.startswith(self.repo) else raw

# ── facts: exported once per graph, reused while graph.sqlite is unchanged ───────────────────────────────
def export(self):
Expand Down Expand Up @@ -1065,7 +1065,7 @@ if __name__ == '__main__':
limit = 10; IN = None; every = '--every' in args; args = [a for a in args if a != '--every']; max_paths = 20
if '--paths' in args: i = args.index('--paths'); max_paths = int(args[i + 1]); every = True; del args[i:i + 2]
if '--limit' in args: i = args.index('--limit'); limit = int(args[i + 1]); del args[i:i + 2]
if '--in' in args: i = args.index('--in'); IN = args[i + 1]; del args[i:i + 2]
if '--in' in args: i = args.index('--in'); IN = args[i + 1].replace('\\', '/'); del args[i:i + 2]
if len(args) < 2: die("usage: axiomcode path <from> <to> [<repo>] [--all] [--limit N] [--in <path fragment>]")
if args[0] == '*' and args[1] == '*': die("one endpoint must be named: path '*' X (everything that reaches X) or path X '*' (everything X reaches)")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def package_tier(repo, changed_files, limit=6000):
dirs[:] = [d for d in dirs if d not in ('node_modules', '.git', 'dist', 'build', 'target', '.axiomcode')]
for f in fs:
if not f.endswith(('.ts', '.tsx', '.js', '.mjs', '.java', '.py', '.cs')): continue # a list that omits an extension makes both tiers below silently inert for that language (#1083's shape)
rel = os.path.relpath(os.path.join(root, f), repo)
rel = os.path.relpath(os.path.join(root, f), repo).replace(os.sep, '/')
if not TESTY.search(rel): continue
seen += 1
if seen > limit: return dict(by_pkg), {'files': sorted(by_name)}, pkgs
Expand Down
Loading