Repository navigation
Conversation
Phase 4b, first half. The toolkit carried the same small helpers in several files, each a verbatim or near copy: fileExists and findPackageRootForFile in four, the PYTHONPATH augmentation in three, collectPythonFilesUnderRoots in two, countParenDelta in three, escapeRegExp in three, stripPythonCommentsAndStrings in two, unqualifyName in two beside normalizeWorkflowReferenceName, and a CLI command resolution in the run driver beside the server's. server/source-files.ts holds the file-system helpers, python-text.ts the text helpers, and the rest import them. The run driver resolves the CLI command through getCliInvocation; a blank setting now means the default, as it does everywhere else. normalizeSourceUriKey had four copies in three packages and a parity test to keep two of them aligned. One function, in diagram-server/server/uri-keys.ts, serves the host, the server and the toolkit; the webview keeps one browser-bound copy of its own instead of two. Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
The run driver keeps its guard against a blank CLI command and says what is missing when it cannot run; the one source-URI key resolves the path, as the server's did, so a trailing slash makes no second key; the scan ceiling's warning says what the caller wants said; a package-root environment is always a copy; the name rule the webview and the toolkit both apply is one function in shared, unqualifiedName; and source-analysis re-exports nothing it does not define: the caller scan's file list is callerScanSourceFiles, the rest is imported from where it lives. Claude-Session: https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 4b of the declutter plan, first half: the duplicated helpers inside the toolkit and the URI key spelled in three packages. The second half (one sidecar transport, one export-op default) follows as its own PR.
What was duplicated
fileExists,findPackageRootForFilefs.statvariant)server/source-files.tswithPythonPackageRootcollectPythonFilesUnderRootscountParenDeltapython-text.tsexports the raw one; its own blanked variant iscountParenDeltaOutsideStringsescapeRegExpescapedRegexSymbol)python-text.tsstripPythonCommentsAndStringspython-text.tsunqualifyNamenormalizeWorkflowReferenceNameresolveCliInvocationre-implementedgetCliInvocation+ the Python-interpreter regexgetCliInvocation, whose config parameter is now the four CLI fields (CliCommandConfig)normalizeSourceUriKeyvscode.Uri+normalize,vscode-uri+resolve), diagram-server, diagram-client (two,URL-based)@dialogram/diagram-server/server/uri-keysfor host, server and toolkit;diagram-client/src/source-uri-key.tsfor the webviewsource-analysis.tsre-exports what it used to define, so its importers and tests are unchanged.Behaviour, and what the review made of it
Meant to be none. Three edges the review sharpened:
cliCommandDefault: ''), and its error names what is actually missing: the command, or a root (workspace folder,package.jsonor.git). A blank setting now falls back to the default, as it does for every other reader.normalizeSourceUriKeyresolves the path (path.resolve), as the server's copy did, so a trailing slash or a.segment makes no second key; the host's copy normalized only.withPythonPackageRootalways returns a copy, never the liveprocess.env.Also from the review: the webview had a third copy of the name-splitting rule, so
unqualifiedNamenow lives in@dialogram/sharedand both the property panel andnormalizeWorkflowReferenceNameuse it;source-analysis.tsre-exports nothing it does not define (the caller scan's bounded file list iscallerScanSourceFiles, its importers readuri-keys,python-textandsource-filesdirectly); the scan ceiling's warning takes its hint from the caller; the stale comment ingraph-load-request-options.tsis gone.Tests
source-files.test.ts(package root, PYTHONPATH, scan options and ceiling),uri-keys.test.ts. Typecheck 5/5, neutrality 5/5, server 443, client 361, extension-core 331, toolkit 330 with the known local wizard timeouts (green when the two files run alone, green in CI).Cut from main before #119–#121; only
CHANGELOG.mdcan conflict.https://claude.ai/code/session_01EToj6RJRMSSHQiqGNMU9wv