@jagilber-org/index-server 1.28.10 → 1.28.19

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.
Files changed (73) hide show
  1. package/CHANGELOG.md +109 -1
  2. package/CONTRIBUTING.md +13 -0
  3. package/README.md +10 -14
  4. package/dist/config/featureConfig.js +4 -1
  5. package/dist/dashboard/client/admin.html +69 -29
  6. package/dist/dashboard/client/js/admin.embeddings.js +97 -5
  7. package/dist/dashboard/client/js/admin.instructions.js +1 -1
  8. package/dist/dashboard/server/AdminPanel.js +38 -0
  9. package/dist/dashboard/server/ApiRoutes.js +14 -1
  10. package/dist/dashboard/server/routes/embeddings.routes.js +76 -1
  11. package/dist/dashboard/server/routes/instructions.routes.js +4 -11
  12. package/dist/dashboard/server/routes/scripts.routes.js +35 -10
  13. package/dist/dashboard/server/routes/status.routes.js +77 -0
  14. package/dist/models/instruction.d.ts +2 -1
  15. package/dist/models/instruction.js +2 -0
  16. package/dist/schemas/index-server.code-schema.json +52478 -0
  17. package/dist/schemas/index.d.ts +7 -164
  18. package/dist/schemas/index.js +45 -63
  19. package/dist/schemas/instructionSchema.d.ts +46 -0
  20. package/dist/schemas/instructionSchema.js +159 -0
  21. package/{schemas → dist/schemas}/json-schema/instruction-content-type.schema.json +6 -4
  22. package/{schemas → dist/schemas}/json-schema/instruction-instruction-entry.schema.json +6 -4
  23. package/dist/schemas/manifest.json +78 -0
  24. package/dist/server/index-server.js +7 -1
  25. package/dist/services/bootstrapGating.js +2 -2
  26. package/dist/services/handlers/instructions.add.js +18 -0
  27. package/dist/services/handlers/instructions.groom.js +6 -1
  28. package/dist/services/handlers/instructions.import.js +42 -7
  29. package/dist/services/handlers.activation.js +3 -1
  30. package/dist/services/handlers.dashboardConfig.js +2 -1
  31. package/dist/services/handlers.feedback.d.ts +4 -4
  32. package/dist/services/handlers.feedback.js +390 -27
  33. package/dist/services/handlers.instructionSchema.js +73 -31
  34. package/dist/services/handlers.search.js +11 -6
  35. package/dist/services/indexLoader.js +7 -0
  36. package/dist/services/instructionRecordValidation.js +32 -84
  37. package/dist/services/mcpConfig/flagCatalog.d.ts +1 -1
  38. package/dist/services/mcpConfig/flagCatalog.js +2 -0
  39. package/dist/services/mcpConfig/formats.js +2 -6
  40. package/dist/services/seedBootstrap.contentModel.d.ts +13 -0
  41. package/dist/services/seedBootstrap.contentModel.js +166 -0
  42. package/dist/services/seedBootstrap.contentTypes.d.ts +5 -0
  43. package/dist/services/seedBootstrap.contentTypes.js +76 -0
  44. package/dist/services/seedBootstrap.d.ts +1 -0
  45. package/dist/services/seedBootstrap.js +87 -10
  46. package/dist/services/toolRegistry.js +52 -24
  47. package/dist/services/toolRegistry.zod.js +84 -37
  48. package/dist/versioning/schemaVersion.d.ts +1 -1
  49. package/dist/versioning/schemaVersion.js +1 -13
  50. package/package.json +17 -3
  51. package/schemas/index-server.code-schema.json +31019 -25047
  52. package/schemas/instruction.schema.json +16 -6
  53. package/schemas/manifest.json +3 -3
  54. package/scripts/README.md +20 -0
  55. package/scripts/build/README.md +41 -0
  56. package/scripts/build/setup-wizard-paths.mjs +27 -0
  57. package/scripts/build/setup-wizard.mjs +7 -21
  58. package/scripts/client/README.md +26 -0
  59. package/scripts/client/index-server-client.ps1 +203 -0
  60. package/scripts/client/index-server-client.sh +149 -0
  61. package/scripts/client/powershell-mcp-server.ps1 +83 -0
  62. package/scripts/client/powershell-mcp-template.ps1 +85 -0
  63. package/scripts/hooks/README.md +40 -0
  64. package/server.json +2 -2
  65. /package/{schemas → dist/schemas}/json-schema/SessionPersistence-persisted-admin-session.schema.json +0 -0
  66. /package/{schemas → dist/schemas}/json-schema/SessionPersistence-persisted-session-history-entry.schema.json +0 -0
  67. /package/{schemas → dist/schemas}/json-schema/SessionPersistence-persisted-web-socket-connection.schema.json +0 -0
  68. /package/{schemas → dist/schemas}/json-schema/SessionPersistence-session-persistence-config.schema.json +0 -0
  69. /package/{schemas → dist/schemas}/json-schema/SessionPersistence-session-persistence-data.schema.json +0 -0
  70. /package/{schemas → dist/schemas}/json-schema/SessionPersistence-session-persistence-manifest.schema.json +0 -0
  71. /package/{schemas → dist/schemas}/json-schema/SessionPersistence-session-persistence-metadata.schema.json +0 -0
  72. /package/{schemas → dist/schemas}/json-schema/instruction-audience-scope.schema.json +0 -0
  73. /package/{schemas → dist/schemas}/json-schema/instruction-requirement-level.schema.json +0 -0
@@ -0,0 +1,83 @@
1
+ <#
2
+ Minimal PowerShell MCP Server (stdio JSON-RPC) for isolation handshake testing.
3
+ Implements:
4
+ - initialize (id:1) -> returns protocolVersion / serverInfo / capabilities
5
+ - emits server/ready notification AFTER initialize result
6
+ - emits notifications/tools/list_changed after ready
7
+ - tools/list request handler
8
+ - tools/call with a single demo tool (echo/upper)
9
+ - ping request (latency / reachability)
10
+ Exits automatically after 30s of inactivity or when INDEX_SERVER_PWS_EXIT_MS is set.
11
+ #>
12
+
13
+ param(
14
+ [int] $IdleExitMs = [int]([Environment]::GetEnvironmentVariable('INDEX_SERVER_PWS_EXIT_MS') | ForEach-Object { if($_){$_} else {30000} })
15
+ )
16
+
17
+ $ErrorActionPreference = 'Stop'
18
+ [Console]::InputEncoding = [System.Text.UTF8Encoding]::UTF8
19
+ [Console]::OutputEncoding = [System.Text.UTF8Encoding]::UTF8
20
+
21
+ $start = Get-Date
22
+ $readyEmitted = $false
23
+ $tools = @(
24
+ @{ name = 'echo/upper'; description = 'Uppercase a string'; inputSchema = @{ type='object'; properties = @{ text = @{ type='string'} }; required = @('text') } }
25
+ )
26
+
27
+ function Write-Json($obj){
28
+ $json = $obj | ConvertTo-Json -Depth 8 -Compress
29
+ [Console]::Out.WriteLine($json)
30
+ }
31
+
32
+ function Send-ReadyOnce {
33
+ if(-not $script:readyEmitted){
34
+ Write-Json @{ jsonrpc='2.0'; method='server/ready'; params=@{ version='0.1.0'; reason='pwsh-minimal' } }
35
+ Write-Json @{ jsonrpc='2.0'; method='notifications/tools/list_changed'; params=@{} }
36
+ $script:readyEmitted = $true
37
+ }
38
+ }
39
+
40
+ $lastActivity = Get-Date
41
+
42
+ while($true){
43
+ if([Console]::In.Peek() -lt 0){ Start-Sleep -Milliseconds 20 } else {
44
+ $line = [Console]::In.ReadLine()
45
+ if([string]::IsNullOrWhiteSpace($line)){ continue }
46
+ $lastActivity = Get-Date
47
+ try { $msg = $line | ConvertFrom-Json -ErrorAction Stop } catch { continue }
48
+ $id = $msg.id
49
+ $method = $msg.method
50
+ if($method -eq 'initialize'){
51
+ $proto = if($msg.params.protocolVersion){ $msg.params.protocolVersion } else { '2025-06-18' }
52
+ $result = @{ protocolVersion=$proto; serverInfo=@{ name='powershell-mcp-minimal'; version='0.1.0' }; capabilities=@{ tools=@{ listChanged=$true } } }
53
+ Write-Json @{ jsonrpc='2.0'; id=$id; result=$result }
54
+ Start-Sleep -Milliseconds 15
55
+ Send-ReadyOnce
56
+ continue
57
+ }
58
+ if($method -eq 'tools/list'){
59
+ Write-Json @{ jsonrpc='2.0'; id=$id; result=@{ tools=$tools } }
60
+ continue
61
+ }
62
+ if($method -eq 'tools/call'){
63
+ $name = $msg.params.name
64
+ if($name -eq 'echo/upper'){
65
+ $text = $msg.params.arguments.text
66
+ $out = [string]::IsNullOrEmpty($text) ? '' : $text.ToUpperInvariant()
67
+ $payload = @{ content = @(@{ type='text'; text=$out }) }
68
+ Write-Json @{ jsonrpc='2.0'; id=$id; result=$payload }
69
+ } else {
70
+ Write-Json @{ jsonrpc='2.0'; id=$id; error=@{ code=-32601; message='Unknown tool'; data=@{ tool=$name } } }
71
+ }
72
+ continue
73
+ }
74
+ if($method -eq 'ping'){
75
+ Write-Json @{ jsonrpc='2.0'; id=$id; result=@{ timestamp=(Get-Date).ToString('o'); uptimeMs=([int]((Get-Date)-$start).TotalMilliseconds) } }
76
+ continue
77
+ }
78
+ if($id){ Write-Json @{ jsonrpc='2.0'; id=$id; error=@{ code=-32601; message='Method not found'; data=@{ method=$method } } } }
79
+ }
80
+ if(((Get-Date)-$lastActivity).TotalMilliseconds -gt $IdleExitMs){ break }
81
+ }
82
+
83
+ exit 0
@@ -0,0 +1,85 @@
1
+ # PowerShell MCP Server Usage Template
2
+ # Safe operations with timeout protection and file logging
3
+ #
4
+ # Usage:
5
+ # .\scripts\powershell-mcp-template.ps1 -LogFile "my-session.log" -Operation "build"
6
+ #
7
+
8
+ param(
9
+ [string]$LogFile = "mcp-session-$(Get-Date -Format 'yyyy-MM-dd-HHmmss').log",
10
+ [string]$Operation = "status",
11
+ [int]$TimeoutSeconds = 15
12
+ )
13
+
14
+ Write-Output "🚀 Index Server - PowerShell MCP Template"
15
+ Write-Output "============================================="
16
+ Write-Output ""
17
+
18
+ # Configure environment for file logging
19
+ $env:INDEX_SERVER_LOG_FILE = $LogFile
20
+ $env:INDEX_SERVER_VERBOSE_LOGGING = "1"
21
+
22
+ Write-Output "📋 Configuration:"
23
+ Write-Output " Log File: $LogFile"
24
+ Write-Output " Operation: $Operation"
25
+ Write-Output " Timeout: $TimeoutSeconds seconds"
26
+ Write-Output " Working Dir: $PWD"
27
+ Write-Output ""
28
+
29
+ # Example operations that would be done via PowerShell MCP
30
+ switch ($Operation.ToLower()) {
31
+ "status" {
32
+ Write-Output "📊 Project Status Check:"
33
+
34
+ # Check build status
35
+ $buildReady = Test-Path "dist/server/index-server.js"
36
+ Write-Output " Build Status: $(if($buildReady){'✅ Ready'}else{'❌ Missing - run npm run build'})"
37
+
38
+ # Check package info
39
+ if (Test-Path "package.json") {
40
+ $pkg = Get-Content "package.json" | ConvertFrom-Json
41
+ Write-Output " Package: $($pkg.name) v$($pkg.version)"
42
+ }
43
+
44
+ # Check source files
45
+ $srcCount = (Get-ChildItem "src" -Filter "*.ts" -Recurse -ErrorAction SilentlyContinue | Measure-Object).Count
46
+ Write-Output " Source Files: $srcCount TypeScript files"
47
+
48
+ # Check existing logs
49
+ $logFiles = @(Get-ChildItem "*.log" -ErrorAction SilentlyContinue)
50
+ Write-Output " Log Files: $($logFiles.Count) files"
51
+ }
52
+
53
+ "build" {
54
+ Write-Output "🔨 Building Index Server:"
55
+ Write-Output " This would run: npm run build"
56
+ Write-Output " With timeout protection and process cleanup"
57
+ }
58
+
59
+ "test" {
60
+ Write-Output "🧪 Running Tests:"
61
+ Write-Output " This would run: npm test"
62
+ Write-Output " With structured logging to: $LogFile"
63
+ }
64
+
65
+ "deploy" {
66
+ Write-Output "🚀 Deployment Operations:"
67
+ Write-Output " This would handle deployment tasks"
68
+ Write-Output " With full audit logging enabled"
69
+ }
70
+
71
+ default {
72
+ Write-Output "❓ Unknown operation: $Operation"
73
+ Write-Output " Available: status, build, test, deploy"
74
+ }
75
+ }
76
+
77
+ Write-Output ""
78
+ Write-Output "✅ Template Complete!"
79
+ Write-Output ""
80
+ Write-Output "💡 To use with PowerShell MCP Server:"
81
+ Write-Output " mcp_powershell-mc_run-powershell:"
82
+ Write-Output " aiAgentTimeoutSec: $TimeoutSeconds"
83
+ Write-Output " confirmed: true"
84
+ Write-Output " workingDirectory: `"<root>\index-server`""
85
+ Write-Output " script: `".\scripts\powershell-mcp-template.ps1 -LogFile '$LogFile' -Operation '$Operation'`""
@@ -0,0 +1,40 @@
1
+ # scripts/hooks
2
+
3
+ Git hook implementations. These are **not** the hooks themselves (those live in
4
+ `.git/hooks/`); these are the scripts that hooks invoke. Managed by `pre-commit`
5
+ via `.pre-commit-config.yaml`. Run `pwsh -File scripts/hooks/setup-hooks.ps1`
6
+ once to wire them up.
7
+
8
+ ## Scripts
9
+
10
+ | Script | Hook | Purpose |
11
+ |--------|------|---------|
12
+ | `pre-commit.mjs` | `pre-commit` | ESM pre-commit runner: lint, type-check, schema validate |
13
+ | `pre-commit.ps1` | `pre-commit` | PowerShell pre-commit runner (PII scan, security scan) |
14
+ | `commit-msg-baseline.mjs` | `commit-msg` | Validate commit message against Conventional Commits |
15
+ | `commit-msg-baseline.ps1` | `commit-msg` | PowerShell shim for `commit-msg-baseline.mjs` |
16
+ | `pre-push.mjs` | `pre-push` | ESM pre-push runner: full test suite gate |
17
+ | `pre-push.ps1` | `pre-push` | PowerShell pre-push runner: build verify + governance |
18
+ | `pre-push-integrity.ps1` | `pre-push` | Assert dist/ integrity before push |
19
+ | `pre-push-log-hygiene.ps1` | `pre-push` | Block if debug log statements remain in staged files |
20
+ | `pre-push-public-guard.cjs` | `pre-push` | CJS guard: block push to public remote without clean-room check |
21
+ | `run-codeql-pre-push.ps1` | `pre-push` | Run CodeQL analysis before push through `hooks/codeql-pre-push.ps1` |
22
+ | `hooks/run-gitleaks-pre-push.ps1` | `pre-push` | Run gitleaks commit-range scanning before push |
23
+ | `run-semgrep-pre-push.ps1` | `pre-push` | Run Semgrep SAST before push |
24
+ | `setup-hooks.cjs` | setup | CJS installer: symlink hook scripts into `.git/hooks/` |
25
+ | `setup-hooks.ps1` | setup | PowerShell installer: same, with Windows path handling |
26
+
27
+ ## Setup
28
+
29
+ ```pwsh
30
+ # Install hooks once after cloning
31
+ pwsh -File scripts/hooks/setup-hooks.ps1
32
+
33
+ # Template-compatible wrapper
34
+ pwsh -File scripts/setup-hooks.ps1
35
+
36
+ # Or via pre-commit
37
+ pre-commit install --hook-type commit-msg --hook-type pre-push
38
+ ```
39
+
40
+ > Do NOT use `--no-verify` to bypass hooks. Fix the gate or fix the code.
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/jagilber-org/index-server",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.28.10",
9
+ "version": "1.28.19",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@jagilber-org/index-server",
14
- "version": "1.28.10",
14
+ "version": "1.28.19",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }