Commit Graph

440 Commits

Author SHA1 Message Date
Michael Chihlas
e5899d81c4 fix: param block detection with nested parens + cursor alignment
The paren depth counter started at 0 and immediately matched before
any '(' was counted, causing param blocks to be detected as ending
on line 0. Added foundOpen flag to require at least one '(' before
checking for balanced depth.

For cursor alignment: switch both textarea and overlay to whitespace-pre
with wrap=off, use explicit 21px line-height (14px * 1.5), and strip
all default pre element margins/padding/borders.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 19:34:45 -04:00
Michael Chihlas
099a4a2b4e fix: align textarea and syntax overlay to fix cursor/text mismatch
The highlighted overlay had double padding (wrapper p-4 + pre p-4) and
its own bg-card background, causing the visible text to drift from the
actual cursor position. Fix: strip pre padding/background in overlay
mode via className prop, add explicit line-height and whitespace-pre-wrap
to both layers so they wrap identically character-for-character.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 19:26:55 -04:00
Michael Chihlas
75c48eab9e fix: handle multi-line param() attributes in parameter detection
Switch from single multiline regex to line-by-line scanning that skips
PowerShell attribute decorators like [Parameter(Mandatory=$true)] and
[ValidateSet(...)]. This correctly detects parameters with attribute
lines above them (the most common real-world pattern).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 19:16:53 -04:00
Michael Chihlas
5efe42583a fix: dismiss stepper on script edit and improve function brace tracking
Stepper now auto-dismisses when the user edits the script body during
detection, preventing stale matchedLine replacements. Function-level
param() block detection uses brace depth counting instead of simple
equality check, correctly handling nested braces in function bodies.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:50:47 -04:00
Michael Chihlas
1bc4078054 feat: wire parameter detection into ScriptTemplateEditor
Adds Detect Parameters button, stepper integration, and handlers
for accepting/skipping candidates with script body placeholder
replacement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:47:10 -04:00
Michael Chihlas
504eff918f feat: add ParameterDetectorStepper component
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:47:06 -04:00
Michael Chihlas
c012ca30e6 feat: add PowerShell parameter detection engine
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:42:54 -04:00
Michael Chihlas
53b07e92c9 feat: add ParameterCandidate type for script parameter detection
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:42:49 -04:00
Michael Chihlas
2366926c67 docs: add parameter detector implementation plan
6-task plan covering type definition, detection engine, stepper UI,
editor integration, manual testing, and final verification.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:35:35 -04:00
Michael Chihlas
abfa7b4cd3 docs: add parameter detector design doc
Client-side PowerShell parameter detection with stepper UI for
converting hardcoded values to template parameters.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 18:33:00 -04:00
Michael Chihlas
029502b64a fix: show helpful message when template has no parameters
Instead of an empty gap between header and Generate button, display
a small info box explaining no parameters are needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 15:49:28 -04:00
Michael Chihlas
d10779dae9 fix: add back link to Manage Templates and fix script preview scroll
Add 'Back to Script Library' link at top of ScriptTemplateListView.
Change right pane in ScriptLibraryPage from overflow-hidden to
overflow-y-auto so the script preview scrolls for long scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 15:38:24 -04:00
Michael Chihlas
5768e04804 fix: eliminate double scrollbar in script editor and extend page scroll area
ScriptBodyEditor: overlay now has overflow-hidden and syncs scroll
position from the textarea via onScroll, so only one scrollbar appears.
ScriptManagePage: outer scroll container is now full-width so scrolling
works even when hovering outside the max-w content area.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 15:32:59 -04:00
Michael Chihlas
0b01692bbd fix: use subtle cyan pill for Manage Templates link, fix editor scroll
Replace pulsing dot with a light cyan background pill that's visible
but not distracting. Remove overflow-hidden from ScriptBodyEditor
wrapper so the textarea content scrolls properly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 15:27:02 -04:00
Michael Chihlas
2b1fd032a2 fix: improve Manage Templates link visibility and editor scroll bug
Add pulsing cyan dot + hover gear rotation to make the link noticeable.
Add overflow-y-auto to ScriptManagePage so the editor form scrolls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-14 15:19:42 -04:00
chihlasm
1e035ac375 fix: move Date.now() out of render in ErrorBoundary to satisfy eslint purity rule
The chunk-reload logic used Date.now() and sessionStorage during render,
triggering react-hooks/purity. Moved to useEffect so side effects run
after commit, fixing the CI lint failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 12:50:29 -04:00
Michael Chihlas
4d36eabfe3 feat: add ScriptManagePage with routing and 'Manage Templates' link
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:58:11 -04:00
Michael Chihlas
8b2ffbbf27 feat: add ScriptTemplateEditor — full CRUD form with metadata, script body, and parameters
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:56:14 -04:00
Michael Chihlas
91e40c2920 feat: add ParameterCard and ParameterSchemaBuilder — visual builder + JSON toggle
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:51:56 -04:00
Michael Chihlas
6819dc1b62 feat: add ScriptTemplateListView component
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:47:36 -04:00
Michael Chihlas
9397e46eec feat: add ScriptBodyEditor with PowerShell syntax highlighting overlay
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:47:16 -04:00
Michael Chihlas
5f7a85db03 feat: add script template permission checks to usePermissions hook
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:44:07 -04:00
Michael Chihlas
f408be29e6 feat: add CRUD and share methods to scriptsApi client
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:44:04 -04:00
Michael Chihlas
0092b15237 feat: add created_by and create/update request types for script templates
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:44:01 -04:00
Michael Chihlas
75fc4f5bf1 test: add integration tests for script template permissions and share endpoint
Also fix conftest.py to support DATABASE_TEST_URL env var for Docker test runs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:40:41 -04:00
Michael Chihlas
8deb78542b feat: refactor script template permissions — engineers manage own, add /share endpoint
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:31:04 -04:00
Michael Chihlas
86110c6ace feat: expose created_by in script template response schemas
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:31:00 -04:00
Michael Chihlas
50486aae89 feat: add can_manage_script_template permission check
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-14 01:30:58 -04:00
Michael Chihlas
8251b08517 docs: add Script Template Editor implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 18:44:20 -04:00
Michael Chihlas
e6826bb5a9 docs: add Script Template Editor design document
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 18:38:31 -04:00
chihlasm
5d3c8fbada docs: add lesson 58 — scriptGeneratorStore.generate() onClick footgun
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 17:06:09 -04:00
chihlasm
bfb6ba352c docs: update CLAUDE.md — add ConnectWise PSA integration section and formatting fixes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 13:24:43 -04:00
chihlasm
1d280a5c78 fix: address code review feedback on pane takeover
- Remove leftover text-left on TemplateCard div (was from button era)
- Use warning text as React key instead of array index

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:41:48 -04:00
chihlasm
87a5988fc3 chore: update stale comment in scriptGeneratorStore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:39:15 -04:00
chihlasm
bcca095bdf feat: delete ScriptGeneratorPanel — superseded by ScriptConfigurePane
The right pane is now ScriptPreview-only. Generate/Download/Copy controls
moved to ScriptConfigurePane in the left pane (configure mode).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:38:31 -04:00
chihlasm
16c0132b02 feat: rewrite ScriptLibraryPage with Browse/Configure pane modes
- Add paneMode state ('browse' | 'configure') local to page
- Move ScriptFilterBar inside left pane column (hidden in configure mode)
- inputValue owned at page level to survive mode transitions
- Left pane: ScriptFilterBar + ScriptTemplateList in browse; ScriptConfigurePane in configure
- Right pane: ScriptPreview only (read-only); empty state when no template selected
- canGenerate derived from usePermissions().isEngineer (matching ScriptGeneratorPanel pattern)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:38:05 -04:00
chihlasm
da86136ef3 fix: update ScriptConfigurePane elevation badge and separator per spec
- Replace unicode ⚠ with ShieldAlert icon in elevation badge
- Fix separator spacing: mb-4 → mt-3 pt-3 per spec

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:35:44 -04:00
chihlasm
93f332e027 feat: add ScriptConfigurePane — configure mode layout
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:32:39 -04:00
chihlasm
cad9dc83bd refactor: ScriptTemplateList — add onConfigure prop threading
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:30:13 -04:00
chihlasm
40ebd2b200 refactor: TemplateCard — remove store subscription, add Configure button
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:29:45 -04:00
chihlasm
48db16ccbf docs: add script library pane takeover implementation plan
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:13:18 -04:00
chihlasm
996244e8bd docs: remove stale copy button language from round 6 review
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 12:00:32 -04:00
chihlasm
7334d55cf2 docs: fix spec issues from round 5 review
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 11:59:50 -04:00
chihlasm
cfcae08981 docs: fix spec issues from round 4 review
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 11:58:23 -04:00
chihlasm
e995e935dc docs: fix spec issues from round 3 review
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 11:57:08 -04:00
chihlasm
0854bca13e docs: fix spec issues from round 2 review
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 11:55:19 -04:00
chihlasm
e7a3ed6982 docs: add script library pane takeover design spec
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 11:49:14 -04:00
chihlasm
844b792bc2 fix: remove redundant wrapper div in password field
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:48:30 -04:00
chihlasm
64b02159e0 fix: wire error prop to Input/Textarea components and eliminate duplicate loadTemplates on mount
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:47:23 -04:00
chihlasm
f988d70bca feat: add /scripts route and Script Library nav entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 02:41:19 -04:00