@plannotator/opencode 0.23.0 → 0.23.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/dist/embedded.js +72 -31
- package/package.json +2 -2
- package/plannotator.html +3 -3
- package/review-editor.html +2 -2
package/dist/embedded.js
CHANGED
|
@@ -339,6 +339,11 @@ var init_code_file2 = __esm(() => {
|
|
|
339
339
|
import { homedir } from "os";
|
|
340
340
|
import { isAbsolute, join as join2, resolve, win32 } from "path";
|
|
341
341
|
import { existsSync as existsSync2, readdirSync } from "fs";
|
|
342
|
+
import { readdir } from "fs/promises";
|
|
343
|
+
function getFileBrowserMaxFiles() {
|
|
344
|
+
const value = Number.parseInt(process.env.PLANNOTATOR_FILE_BROWSER_MAX_FILES ?? "", 10);
|
|
345
|
+
return Number.isFinite(value) && value > 0 ? value : DEFAULT_FILE_BROWSER_MAX_FILES;
|
|
346
|
+
}
|
|
342
347
|
function normalizeSeparators(input) {
|
|
343
348
|
return input.replace(/\\/g, "/");
|
|
344
349
|
}
|
|
@@ -429,39 +434,69 @@ function fileExists(filePath) {
|
|
|
429
434
|
return false;
|
|
430
435
|
}
|
|
431
436
|
}
|
|
432
|
-
function walkFiles(dir, root, results, ignoredDirs, fileMatcher) {
|
|
437
|
+
function walkFiles(dir, root, results, ignoredDirs, fileMatcher, state) {
|
|
438
|
+
if (state.visitedFiles >= state.limit)
|
|
439
|
+
return;
|
|
433
440
|
const entries = readdirSync(dir, { withFileTypes: true });
|
|
434
441
|
for (const entry of entries) {
|
|
442
|
+
if (state.visitedFiles >= state.limit)
|
|
443
|
+
return;
|
|
435
444
|
if (entry.isDirectory()) {
|
|
436
445
|
if (ignoredDirs.some((d) => d === entry.name + "/"))
|
|
437
446
|
continue;
|
|
438
447
|
try {
|
|
439
|
-
walkFiles(join2(dir, entry.name), root, results, ignoredDirs, fileMatcher);
|
|
448
|
+
walkFiles(join2(dir, entry.name), root, results, ignoredDirs, fileMatcher, state);
|
|
440
449
|
} catch {}
|
|
441
|
-
} else if (entry.isFile()
|
|
442
|
-
|
|
443
|
-
|
|
450
|
+
} else if (entry.isFile()) {
|
|
451
|
+
state.visitedFiles += 1;
|
|
452
|
+
if (fileMatcher(entry.name)) {
|
|
453
|
+
const relative = join2(dir, entry.name).slice(root.length + 1).replace(/\\/g, "/");
|
|
454
|
+
results.push(relative);
|
|
455
|
+
}
|
|
444
456
|
}
|
|
445
457
|
}
|
|
446
458
|
}
|
|
447
459
|
function walkMarkdownFiles(dir, root, results, ignoredDirs) {
|
|
448
460
|
try {
|
|
449
|
-
walkFiles(dir, root, results, ignoredDirs, (name) => /\.(mdx?|txt)$/i.test(name));
|
|
461
|
+
walkFiles(dir, root, results, ignoredDirs, (name) => /\.(mdx?|txt)$/i.test(name), { visitedFiles: 0, limit: getFileBrowserMaxFiles() });
|
|
450
462
|
} catch {}
|
|
451
463
|
}
|
|
452
464
|
function fileListCacheKey(projectRoot, kind) {
|
|
453
465
|
return `${projectRoot}|${kind}`;
|
|
454
466
|
}
|
|
455
|
-
function
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
467
|
+
async function walkCodeFiles(dir, root, results, state) {
|
|
468
|
+
if (state.visitedFiles >= state.limit)
|
|
469
|
+
return;
|
|
470
|
+
const entries = await readdir(dir, { withFileTypes: true });
|
|
471
|
+
for (const entry of entries) {
|
|
472
|
+
if (state.visitedFiles >= state.limit)
|
|
473
|
+
return;
|
|
474
|
+
if (entry.isDirectory()) {
|
|
475
|
+
if (CODE_IGNORED_DIRS.some((d) => d === entry.name + "/"))
|
|
476
|
+
continue;
|
|
477
|
+
try {
|
|
478
|
+
await walkCodeFiles(join2(dir, entry.name), root, results, state);
|
|
479
|
+
} catch {}
|
|
480
|
+
} else if (entry.isFile()) {
|
|
481
|
+
state.visitedFiles += 1;
|
|
482
|
+
if (CODE_FILE_REGEX.test(entry.name)) {
|
|
483
|
+
const relative = join2(dir, entry.name).slice(root.length + 1).replace(/\\/g, "/");
|
|
484
|
+
results.push(relative);
|
|
485
|
+
}
|
|
463
486
|
}
|
|
464
|
-
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
async function startCodeWalk(projectRoot) {
|
|
490
|
+
try {
|
|
491
|
+
const results = [];
|
|
492
|
+
await walkCodeFiles(projectRoot, projectRoot, results, {
|
|
493
|
+
visitedFiles: 0,
|
|
494
|
+
limit: getFileBrowserMaxFiles()
|
|
495
|
+
});
|
|
496
|
+
return results;
|
|
497
|
+
} catch {
|
|
498
|
+
return null;
|
|
499
|
+
}
|
|
465
500
|
}
|
|
466
501
|
function warmFileListCache(projectRoot, kind) {
|
|
467
502
|
const key = fileListCacheKey(projectRoot, kind);
|
|
@@ -598,7 +633,13 @@ function resolveMarkdownFile(input, projectRoot) {
|
|
|
598
633
|
return { kind: "not_found", input: originalInput };
|
|
599
634
|
}
|
|
600
635
|
function hasMarkdownFiles(dirPath, excludedDirs = IGNORED_DIRS, extensions = /\.mdx?$/i) {
|
|
636
|
+
const state = {
|
|
637
|
+
visitedFiles: 0,
|
|
638
|
+
limit: getFileBrowserMaxFiles()
|
|
639
|
+
};
|
|
601
640
|
function walk(dir) {
|
|
641
|
+
if (state.visitedFiles >= state.limit)
|
|
642
|
+
return false;
|
|
602
643
|
let entries;
|
|
603
644
|
try {
|
|
604
645
|
entries = readdirSync(dir, { withFileTypes: true });
|
|
@@ -606,20 +647,24 @@ function hasMarkdownFiles(dirPath, excludedDirs = IGNORED_DIRS, extensions = /\.
|
|
|
606
647
|
return false;
|
|
607
648
|
}
|
|
608
649
|
for (const entry of entries) {
|
|
650
|
+
if (state.visitedFiles >= state.limit)
|
|
651
|
+
return false;
|
|
609
652
|
if (entry.isDirectory()) {
|
|
610
653
|
if (excludedDirs.some((d) => d === entry.name + "/"))
|
|
611
654
|
continue;
|
|
612
655
|
if (walk(join2(dir, entry.name)))
|
|
613
656
|
return true;
|
|
614
|
-
} else if (entry.isFile()
|
|
615
|
-
|
|
657
|
+
} else if (entry.isFile()) {
|
|
658
|
+
state.visitedFiles += 1;
|
|
659
|
+
if (extensions.test(entry.name))
|
|
660
|
+
return true;
|
|
616
661
|
}
|
|
617
662
|
}
|
|
618
663
|
return false;
|
|
619
664
|
}
|
|
620
665
|
return walk(dirPath);
|
|
621
666
|
}
|
|
622
|
-
var MARKDOWN_PATH_REGEX, WINDOWS_DRIVE_PATH_PATTERNS, IGNORED_DIRS, CODE_IGNORED_DIRS, FILE_LIST_CACHE_TTL_MS = 30000, fileListCache;
|
|
667
|
+
var MARKDOWN_PATH_REGEX, WINDOWS_DRIVE_PATH_PATTERNS, IGNORED_DIRS, CODE_IGNORED_DIRS, DEFAULT_FILE_BROWSER_MAX_FILES = 5000, FILE_LIST_CACHE_TTL_MS = 30000, fileListCache;
|
|
623
668
|
var init_resolve_file = __esm(() => {
|
|
624
669
|
init_code_file2();
|
|
625
670
|
init_code_file2();
|
|
@@ -38407,7 +38452,7 @@ var init_ssr = __esm(() => {
|
|
|
38407
38452
|
|
|
38408
38453
|
// ../../packages/server/reference-handlers.ts
|
|
38409
38454
|
import { existsSync as existsSync9, statSync as statSync5 } from "fs";
|
|
38410
|
-
import { readdir } from "fs/promises";
|
|
38455
|
+
import { readdir as readdir2 } from "fs/promises";
|
|
38411
38456
|
import { join as join12, relative as relative2, resolve as resolve6 } from "path";
|
|
38412
38457
|
function getAllowedRootPaths(options) {
|
|
38413
38458
|
const rawRoots = options?.rootPaths?.length ? options.rootPaths : [options?.rootPath ?? process.cwd()];
|
|
@@ -38778,10 +38823,6 @@ async function handleObsidianDoc(req) {
|
|
|
38778
38823
|
function includeWorkspaceFile(relativePath, _change) {
|
|
38779
38824
|
return FILE_BROWSER_EXTENSIONS.test(relativePath) && !isFileBrowserExcludedPath(relativePath);
|
|
38780
38825
|
}
|
|
38781
|
-
function getFileBrowserMaxFiles() {
|
|
38782
|
-
const value = Number.parseInt(process.env.PLANNOTATOR_FILE_BROWSER_MAX_FILES ?? "", 10);
|
|
38783
|
-
return Number.isFinite(value) && value > 0 ? value : DEFAULT_FILE_BROWSER_MAX_FILES;
|
|
38784
|
-
}
|
|
38785
38826
|
function addFileBrowserFile(state, relativePath) {
|
|
38786
38827
|
if (state.files.has(relativePath))
|
|
38787
38828
|
return;
|
|
@@ -38796,7 +38837,7 @@ async function walkFileBrowserFiles(dir, root3, state) {
|
|
|
38796
38837
|
return;
|
|
38797
38838
|
let entries;
|
|
38798
38839
|
try {
|
|
38799
|
-
entries = await
|
|
38840
|
+
entries = await readdir2(dir, { withFileTypes: true });
|
|
38800
38841
|
} catch {
|
|
38801
38842
|
return;
|
|
38802
38843
|
}
|
|
@@ -38851,7 +38892,7 @@ async function handleFileBrowserFiles(req) {
|
|
|
38851
38892
|
return Response.json({ error: "Failed to list directory files" }, { status: 500 });
|
|
38852
38893
|
}
|
|
38853
38894
|
}
|
|
38854
|
-
var FILE_BROWSER_EXTENSIONS
|
|
38895
|
+
var FILE_BROWSER_EXTENSIONS;
|
|
38855
38896
|
var init_reference_handlers = __esm(() => {
|
|
38856
38897
|
init_reference_common();
|
|
38857
38898
|
init_workspace_status();
|
|
@@ -38866,7 +38907,7 @@ var init_reference_handlers = __esm(() => {
|
|
|
38866
38907
|
});
|
|
38867
38908
|
|
|
38868
38909
|
// ../../node_modules/.bun/readdirp@5.0.0/node_modules/readdirp/index.js
|
|
38869
|
-
import { lstat, readdir as
|
|
38910
|
+
import { lstat, readdir as readdir3, realpath as realpath2, stat as stat2 } from "fs/promises";
|
|
38870
38911
|
import { join as pjoin, relative as prelative, resolve as presolve, sep as psep } from "path";
|
|
38871
38912
|
import { Readable } from "stream";
|
|
38872
38913
|
function readdirp(root3, options = {}) {
|
|
@@ -39032,7 +39073,7 @@ var init_readdirp = __esm(() => {
|
|
|
39032
39073
|
async _exploreDir(path2, depth) {
|
|
39033
39074
|
let files;
|
|
39034
39075
|
try {
|
|
39035
|
-
files = await
|
|
39076
|
+
files = await readdir3(path2, this._rdOptions);
|
|
39036
39077
|
} catch (error) {
|
|
39037
39078
|
this._onError(error);
|
|
39038
39079
|
}
|
|
@@ -39799,7 +39840,7 @@ var init_handler = __esm(() => {
|
|
|
39799
39840
|
// ../../node_modules/.bun/chokidar@5.0.0/node_modules/chokidar/index.js
|
|
39800
39841
|
import { EventEmitter } from "events";
|
|
39801
39842
|
import { stat as statcb, Stats } from "fs";
|
|
39802
|
-
import { readdir as
|
|
39843
|
+
import { readdir as readdir4, stat as stat4 } from "fs/promises";
|
|
39803
39844
|
import * as sp2 from "path";
|
|
39804
39845
|
function arrify(item) {
|
|
39805
39846
|
return Array.isArray(item) ? item : [item];
|
|
@@ -39889,7 +39930,7 @@ class DirEntry {
|
|
|
39889
39930
|
return;
|
|
39890
39931
|
const dir = this.path;
|
|
39891
39932
|
try {
|
|
39892
|
-
await
|
|
39933
|
+
await readdir4(dir);
|
|
39893
39934
|
} catch (err) {
|
|
39894
39935
|
if (this._removeWatcher) {
|
|
39895
39936
|
this._removeWatcher(sp2.dirname(dir), sp2.basename(dir));
|
|
@@ -72850,7 +72891,6 @@ async function startPlannotatorServer(options) {
|
|
|
72850
72891
|
const configuredPort = getServerPort();
|
|
72851
72892
|
const wslFlag = await isWSL();
|
|
72852
72893
|
const gitUser = detectGitUser();
|
|
72853
|
-
warmFileListCache(process.cwd(), "code");
|
|
72854
72894
|
let archivePlans = [];
|
|
72855
72895
|
let initialArchivePlan = "";
|
|
72856
72896
|
let resolveDone;
|
|
@@ -73201,6 +73241,7 @@ async function startPlannotatorServer(options) {
|
|
|
73201
73241
|
}
|
|
73202
73242
|
const port = server2.port;
|
|
73203
73243
|
const serverUrl = `http://localhost:${port}`;
|
|
73244
|
+
warmFileListCache(process.cwd(), "code");
|
|
73204
73245
|
if (onReady) {
|
|
73205
73246
|
onReady(serverUrl, isRemote, port);
|
|
73206
73247
|
}
|
|
@@ -93536,7 +93577,6 @@ var init_agent_terminal2 = __esm(() => {
|
|
|
93536
93577
|
import { existsSync as existsSync19 } from "fs";
|
|
93537
93578
|
import { dirname as dirname8, resolve as resolvePath4 } from "path";
|
|
93538
93579
|
async function startAnnotateServer(options) {
|
|
93539
|
-
warmFileListCache(process.cwd(), "code");
|
|
93540
93580
|
const {
|
|
93541
93581
|
markdown,
|
|
93542
93582
|
filePath,
|
|
@@ -93960,6 +94000,7 @@ async function startAnnotateServer(options) {
|
|
|
93960
94000
|
}
|
|
93961
94001
|
const port = server2.port;
|
|
93962
94002
|
const serverUrl = `http://localhost:${port}`;
|
|
94003
|
+
warmFileListCache(process.cwd(), "code");
|
|
93963
94004
|
if (onReady) {
|
|
93964
94005
|
onReady(serverUrl, isRemote, port);
|
|
93965
94006
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plannotator/opencode",
|
|
3
|
-
"version": "0.23.
|
|
3
|
+
"version": "0.23.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Plannotator plugin for OpenCode - interactive plan review with visual annotation",
|
|
6
6
|
"author": "backnotprop",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@opencode-ai/plugin": "^1.1.10"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@plannotator/server": "0.23.
|
|
42
|
+
"@plannotator/server": "0.23.1",
|
|
43
43
|
"@plannotator/shared": "0.0.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|