@enfocussw/switch-scripting-context 25.11.0-beta.15 → 25.11.0-beta.17

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/CHANGELOG.md CHANGED
@@ -3,6 +3,30 @@
3
3
  All notable changes to this package are documented here. Format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
 
6
+ ## [Unreleased]
7
+
8
+ ## [25.11.0-beta.17] - 2026-09-11
9
+
10
+ ### Changed
11
+ - `job.md`'s `sendToData()` entry and `connection.md`'s `getPropertyStringValue()` entry now warn
12
+ directly, at the point an agent is most likely to read them, that there is no way to check in
13
+ advance whether a connection accepts a given traffic light level. The warning previously lived
14
+ only in a separate section agents weren't always reaching first.
15
+
16
+ ## [25.11.0-beta.16] - 2026-09-10
17
+
18
+ ### Added
19
+ - Connection docs clarify that traffic light levels (`Connection.Level.Success`/`Warning`/`Error`)
20
+ only select where `sendToData()`/`sendToLog()` route a job; they cannot be read back from a
21
+ connection object, and `sendToData()` fails the job if no connected level matches. Scripts that
22
+ need optional traffic light routing should expose a custom property and fall back to
23
+ `sendToNull()`.
24
+
25
+ ### Fixed
26
+ - `switch-scripting.md`'s own text told agents to grep a `docs/` prefix that only exists in this
27
+ repo's source tree, not in a consuming project's copied docs folder. Agents following that
28
+ instruction literally hit a folder that doesn't exist. The text now describes the copied layout.
29
+
6
30
  ## [25.11.0-beta.15] - 2026-09-10
7
31
 
8
32
  ### Added
@@ -18,6 +42,9 @@ All notable changes to this package are documented here. Format follows
18
42
  `docs/switch-appstore/`. Update any bookmarked doc paths after upgrading.
19
43
  - Dropped the `api-` prefix from doc filenames, for example `switch-api/job.md`, since each file's
20
44
  folder already says what kind of doc it is.
45
+ - Each doc file now carries its own routing metadata (trigger and summary) as YAML frontmatter,
46
+ generated into the routing table and README's doc list instead of hand-duplicated in both.
47
+ README's descriptions now match the table's wording exactly; a few had drifted apart.
21
48
 
22
49
  ### Fixed
23
50
  - `init` now removes the destination docs folder before copying, instead of only adding and
package/README.md CHANGED
@@ -4,7 +4,7 @@ AI coding assistant context for [Enfocus Switch](https://www.enfocus.com/en/swit
4
4
 
5
5
  Installs curated API reference docs and generates config files for 8 AI coding agents (Claude Code, GitHub Copilot, Cursor, Codex CLI/OpenCode, Gemini CLI, Windsurf, Zed, and Cline) so AI assistants understand the Switch scripting API out of the box.
6
6
 
7
- See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.0-beta.15/CHANGELOG.md) (also included in this package) for what's changed between versions.
7
+ See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.0-beta.17/CHANGELOG.md) (also included in this package) for what's changed between versions.
8
8
 
9
9
  ## Usage
10
10
 
@@ -84,7 +84,7 @@ A few things this gets you without asking for them by name:
84
84
  properties (app path/licence) are off-limits and left to SwitchScripter's GUI instead.
85
85
 
86
86
  Re-run `init` after upgrading this package so the copied docs and generated config files catch up.
87
- See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.0-beta.15/CHANGELOG.md) for what changed.
87
+ See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.0-beta.17/CHANGELOG.md) for what changed.
88
88
 
89
89
  ## Options
90
90
 
@@ -131,27 +131,29 @@ npm install --save-dev "https://github.com/enfocus-switch/types-switch-scripting
131
131
  The `switch-docs/` folder contains:
132
132
 
133
133
  - `switch-scripting.md`: master index with execution environment rules and "load when" routing table
134
- - `switch-project/project-planning.md`: pre-scaffolding checklist covering Script vs App, job-processing approach, target OS, Switch version baseline, concurrency, native/binary npm dependencies, Appstore competition risk
135
- - `switch-api/entry-points.md`: all entry point signatures and when each is called
136
- - `switch-api/job.md`: `Job` class signatures for routing, file access, child jobs, private data, datasets
134
+ <!-- docs-index:readme begin -->
135
+ - `switch-project/project-planning.md`: Pre-scaffolding checklist: Script vs App, job-processing approach, target OS, Switch version baseline, concurrency, native/binary npm dependencies, Appstore competition risk
136
+ - `switch-api/entry-points.md`: All entry point signatures, constraints, and when each is called
137
+ - `switch-api/switch.md`: `Switch` (`s`): global data, webhooks, abort, server utilities
137
138
  - `switch-api/flow-element.md`: `FlowElement`: properties, connections, job creation, logging
138
- - `switch-api/switch.md`: `Switch` global: global data, webhooks, abort, server utilities
139
+ - `switch-api/job.md`: `Job` **signatures**: routing, file access, child jobs, private data, datasets
139
140
  - `switch-api/connection.md`: `Connection`: type, properties, file count
140
- - `switch-api/http.md`: `HttpRequest` / `HttpResponse` and webhook pattern
141
- - `switch-api/enums.md`: all enums with string values (`LogLevel`, `AccessLevel`, `Scope`, etc.)
142
- - `switch-api/document-classes.md`: `PdfDocument`, `ImageDocument`, `XmlDocument`, `XmpDocument`
143
- - `switch-project/script-declaration.md`: XML declaration reference
144
- - `switch-project/script-structure.md`: script folder contents, manifest format, Node.js version per Switch release, Script vs App
145
- - `switch-project/tooling.md`: SwitchScriptTool commands, script folder vs package, build and deployment
146
- - `switch-project/debugging.md`: enabling debug mode, debuggable entry points, VS Code attach
147
- - `switch-api/logging.md`: log levels, when/what to log, `console.log` limitation, common gotchas
148
- - `switch-project/logs-and-dataroot.md`: locating the application data root, querying `ServerLogs.db3` directly to diagnose a script
149
- - `switch-project/vscode.md`: type declarations, tsconfig for TypeScript 6, ESLint rules
150
- - `switch-project/property-editors.md`: property editor types and string return values
151
- - `switch-api/job-patterns.md`: `Job` rules and gotchas covering file access semantics, temp cleanup, routing rules, child jobs, executor limits
152
- - `switch-api/execution-environment.md`: execution modes, process model, state persistence across jobs, error handling, npm/native module constraints
153
- - `switch-appstore/app-guidelines.md`: pre-publish checklist for Appstore apps covering property naming/tooltips/editors, entry point and sendTo consistency, logging quality, packaging, app-only submission rules
154
- - `switch-project/property-documentation.md`: writing guidance for `Tooltip` and `DetailedInfo` content on properties and connections
155
- - `switch-appstore/app-store-listing.md`: writing guidance for the Appstore listing fields (`Description`, `Compatibility`, `SupportInfo`, `AppDiscovery`, `Connections`)
156
- - `switch-appstore/app-manual.md`: writing guidance for the separate app manual document uploaded during Appstore review
157
- - `switch-appstore/app-store-submission.md`: writing guidance for the Appstore website submission forms (Short Description, What's new, Eula, icon specs)
141
+ - `switch-api/http.md`: `HttpRequest` / `HttpResponse` + webhook pattern
142
+ - `switch-api/enums.md`: All enums with string values (`LogLevel`, `AccessLevel`, `DatasetModel`, `Scope`, `Priority`, `Connection.Level`, etc.)
143
+ - `switch-api/document-classes.md`: `PdfDocument`, `PdfPage`, `ImageDocument`, `XmlDocument`, `XmpDocument`: read-only file introspection
144
+ - `switch-project/script-structure.md`: What files a script folder contains, `manifest.xml` format, Node.js version per Switch release, Script vs App
145
+ - `switch-project/tooling.md`: SwitchScriptTool commands and install paths, folder vs `.sscript` trade-offs, deployment
146
+ - `switch-project/debugging.md`: Enabling debug mode in Switch Designer, debuggable entry points, VS Code attach
147
+ - `switch-project/vscode.md`: Type declarations, tsconfig for TypeScript 6, ESLint rules
148
+ - `switch-project/script-declaration.md`: XML declaration reference: properties, connections, execution config; agents may edit this file directly
149
+ - `switch-project/property-editors.md`: Property editor types, string return values, literal editors, dropdowns
150
+ - `switch-api/job-patterns.md`: `Job` **rules and gotchas**: file access semantics, temp cleanup, which `sendTo*()` suits which connection type, dataset/child ordering, executor limits
151
+ - `switch-api/execution-environment.md`: Execution modes (`Concurrent`/`Serialized`, `ExecutionGroup`, `NumberOfSlots`), process/concurrency model, state persistence across job invocations, unhandled-rejection behavior, npm/native module constraints
152
+ - `switch-api/logging.md`: Log level semantics, logging practice, `console.log` limitation, common gotchas
153
+ - `switch-project/logs-and-dataroot.md`: Locating the Application Data Root, querying `ServerLogs.db3` directly
154
+ - `switch-appstore/app-guidelines.md`: Pre-publish checklist for Appstore apps: property naming/tooltips/editors, entry point and sendTo consistency, logging quality, packaging, and the app-only submission rules (localization, signed universal macOS binaries)
155
+ - `switch-project/property-documentation.md`: Writing guidance for `Tooltip` and `DetailedInfo` content on properties/connections
156
+ - `switch-appstore/app-store-listing.md`: Writing guidance for the declaration's Appstore listing fields: `Description`, `Compatibility`, `SupportInfo`, `AppDiscovery`, `Connections`
157
+ - `switch-appstore/app-manual.md`: Writing guidance for the separate app manual document uploaded during Appstore review (`documentation-app_name.docx` template)
158
+ - `switch-appstore/app-store-submission.md`: Writing guidance for the Create Appstore App / Create Appstore App Version web forms: Short Description, What's new, Eula, icon specs, and which fields reuse content already written elsewhere
159
+ <!-- docs-index:readme end -->
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: connection
3
+ category: switch-api
4
+ order: 6
5
+ summary: "`Connection`: type, properties, file count"
6
+ triggers:
7
+ - "Routing to specific connections or reading connection properties"
8
+ ---
9
+
1
10
  # Connection Class
2
11
 
3
12
  A `Connection` represents an outgoing connection from the flow element. Obtain instances via `flowElement.getOutConnections()`.
@@ -28,6 +37,8 @@ connection.getPropertyStringValue(tag: string): Promise<string | string[]>
28
37
  ```
29
38
  Returns the connection property value as a string. Throws `"Invalid tag: <tag>"` if the tag is unknown **or if it's a `Dependency` dependent currently hidden by its master's value** — see [script-declaration.md § Dependency](../switch-project/script-declaration.md#custom-property-elements-elementfields). Before fetching a dependent property, confirm its condition holds (from the already-read master value, or via `hasProperty(tag)` below) rather than fetching it unconditionally.
30
39
 
40
+ This is **not** how to check which traffic light level(s) a connection accepts before calling `job.sendToData()` — `"Success"`/`"Warning"`/`"Error"` are not property tags, so passing one throws the same invalid-tag error. There is no supported way to check in advance; see [Connection.Level enum](#connectionlevel-enum) below.
41
+
31
42
  ```ts
32
43
  connection.getPropertyType(tag: string): PropertyType
33
44
  ```
@@ -52,7 +63,7 @@ Returns the number of files in the folder at the other end of this connection. I
52
63
 
53
64
  ## Connection.Level enum
54
65
 
55
- Used with `job.sendToData()` and `job.sendToLog()` for traffic light connections.
66
+ Used with `job.sendToData()` and `job.sendToLog()` to select which traffic light connection a job routes to.
56
67
 
57
68
  | Value | String |
58
69
  |---|---|
@@ -61,3 +72,9 @@ Used with `job.sendToData()` and `job.sendToLog()` for traffic light connections
61
72
  | `Connection.Level.Error` | `"error"` |
62
73
 
63
74
  Available as `EnfocusSwitch.Connection.Level.*` outside `main.ts`.
75
+
76
+ **Traffic light levels are not a readable connection property.** `flowElement.getOutConnections()`
77
+ returns the outgoing `Connection` objects, but the supported API has no way to determine which
78
+ level(s) a given connection accepts. Don't call `connection.getPropertyStringValue("Success")`, `"Warning"`, or `"Error"` expecting to
79
+ read this back; those are not valid property tags for a traffic light connection. To route
80
+ optionally, see [job-patterns.md § Sending jobs](job-patterns.md#sending-jobs).
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: document-classes
3
+ category: switch-api
4
+ order: 9
5
+ summary: "`PdfDocument`, `PdfPage`, `ImageDocument`, `XmlDocument`, `XmpDocument`: read-only file introspection"
6
+ triggers:
7
+ - "Inspecting PDF, image, XML, or XMP file contents"
8
+ ---
9
+
1
10
  # Document Classes
2
11
 
3
12
  Read-only document introspection utilities. All methods may throw — wrap in `try/catch`. Load this file when working with PDF, image, XML, or XMP documents.
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: entry-points
3
+ category: switch-api
4
+ order: 2
5
+ summary: "All entry point signatures, constraints, and when each is called"
6
+ triggers:
7
+ - "Scaffolding a script, adding/editing an entry point, or making any edit to main.ts/main.js"
8
+ ---
9
+
1
10
  # Switch Script Entry Points
2
11
 
3
12
  Entry points are top-level `async` functions with specific names. They are **not exported**. Switch calls them automatically based on flow events.
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: enums
3
+ category: switch-api
4
+ order: 8
5
+ summary: "All enums with string values (`LogLevel`, `AccessLevel`, `DatasetModel`, `Scope`, `Priority`, `Connection.Level`, etc.)"
6
+ triggers:
7
+ - "Looking up enum values"
8
+ ---
9
+
1
10
  # Switch Scripting Enums
2
11
 
3
12
  All enums are available globally in `main.ts`. They are also accessible via `EnfocusSwitch.*` when used outside `main.ts` (e.g. in imported modules).
@@ -68,7 +77,9 @@ Used with `job.sendToData()` and `job.sendToLog()` for traffic light connections
68
77
  | `Connection.Level.Warning` | `"warning"` |
69
78
  | `Connection.Level.Error` | `"error"` |
70
79
 
71
- Also available as `EnfocusSwitch.Connection.Level.*` outside `main.ts`.
80
+ Also available as `EnfocusSwitch.Connection.Level.*` outside `main.ts`. It selects which level to
81
+ route to; it is not a property you can read back from a `Connection` object, see
82
+ [connection.md § Connection.Level enum](connection.md#connectionlevel-enum).
72
83
 
73
84
  ## HttpRequest.Method
74
85
 
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: execution-environment
3
+ category: switch-api
4
+ order: 17
5
+ summary: "Execution modes (`Concurrent`/`Serialized`, `ExecutionGroup`, `NumberOfSlots`), process/concurrency model, state persistence across job invocations, unhandled-rejection behavior, npm/native module constraints"
6
+ triggers:
7
+ - "Choosing or changing an execution mode, relying on module-level state across jobs, handling errors/rejections, or using third-party npm packages"
8
+ ---
9
+
1
10
  # Execution Environment
2
11
 
3
12
  How the Node.js process a script runs in behaves, beyond the entry point API itself. Apart from the
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: flow-element
3
+ category: switch-api
4
+ order: 4
5
+ summary: "`FlowElement`: properties, connections, job creation, logging"
6
+ triggers:
7
+ - "Reading properties, creating jobs, logging, connections"
8
+ ---
9
+
1
10
  # FlowElement Class
2
11
 
3
12
  The `FlowElement` instance `flowElement` is passed to every entry point that operates on a flow element. It provides access to properties, connections, job creation, and logging.
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: http
3
+ category: switch-api
4
+ order: 7
5
+ summary: "`HttpRequest` / `HttpResponse` + webhook pattern"
6
+ triggers:
7
+ - "Handling incoming HTTP webhooks"
8
+ ---
9
+
1
10
  # HttpRequest & HttpResponse Classes
2
11
 
3
12
  Used in the `httpRequestTriggeredSync` and `httpRequestTriggeredAsync` entry points. Webhook subscriptions are registered via `s.httpRequestSubscribe()` in `flowStartTriggered`.
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: job-patterns
3
+ category: switch-api
4
+ order: 16
5
+ summary: "`Job` **rules and gotchas**: file access semantics, temp cleanup, which `sendTo*()` suits which connection type, dataset/child ordering, executor limits"
6
+ triggers:
7
+ - "Writing or reviewing job-handling code. Pair with `job.md` when you also need signatures"
8
+ ---
9
+
1
10
  # Job Patterns and Behavioral Rules
2
11
 
3
12
  Common behavioral rules for file access, routing, temp file cleanup, and child jobs. These are the most frequent sources of bugs.
@@ -82,6 +91,12 @@ await fs.promises.rm(tempPath);
82
91
  Conversely, don't declare a Success/Warning/Error element the script never routes to — omit it from
83
92
  `ConnectionFields` entirely (see the TrafficLight example in
84
93
  [script-declaration.md](../switch-project/script-declaration.md#connectionfields)).
94
+ `sendToData(level)` fails the job if no connected outgoing data connection accepts that level,
95
+ and there is no supported way to check in advance which levels are wired up (see
96
+ [connection.md § Connection.Level enum](connection.md#connectionlevel-enum)). If routing at a
97
+ given level is optional rather than guaranteed by the flow design, expose an explicit custom
98
+ property that lets the flow author opt in or out, and call `job.sendToNull()` when opted out
99
+ instead of guessing whether `sendToData()` will succeed.
85
100
  - Prefer `job.fail()`/`flowElement.failProcess()` for genuine processing errors (see
86
101
  [logging.md](logging.md)) over silently routing a failed job to a generic error connection —
87
102
  reserve an error `TrafficLight` connection for cases the flow author should be able to reroute
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: job
3
+ category: switch-api
4
+ order: 5
5
+ summary: "`Job` **signatures**: routing, file access, child jobs, private data, datasets"
6
+ triggers:
7
+ - "Looking up what a `job.*` method takes, returns, or throws"
8
+ ---
9
+
1
10
  # Job Class
2
11
 
3
12
  A `Job` represents a file or folder moving through the flow. It is passed to `jobArrived` and can be created via `flowElement.createJob()` or `job.createChild()`. Every job must be routed with a `sendTo*()` call or `fail()` before the entry point ends (or at a later time via `timerFired`).
@@ -56,7 +65,7 @@ Send to a specific connection (any type). Get connections via `flowElement.getOu
56
65
  ```ts
57
66
  job.sendToData(level: Connection.Level, newName?: string): Promise<void>
58
67
  ```
59
- Send via a traffic light "data" connection at the specified level. Fails the job if no matching connection exists.
68
+ Send via a traffic light "data" connection at the specified level. Fails the job if no matching connection exists. **There is no supported way to check in advance whether a connection at that level exists** — don't call `connection.getPropertyStringValue("Success")`/`"Warning"`/`"Error"` expecting to detect this; that throws an invalid-tag error, since traffic light levels aren't a readable connection property. See [job-patterns.md § Sending jobs](job-patterns.md#sending-jobs) for the pattern (an explicit custom property plus `job.sendToNull()`).
60
69
 
61
70
  ```ts
62
71
  job.sendToLog(level: Connection.Level, model: DatasetModel, newName?: string): Promise<void>
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: logging
3
+ category: switch-api
4
+ order: 18
5
+ summary: "Log level semantics, logging practice, `console.log` limitation, common gotchas"
6
+ triggers:
7
+ - "Adding or reviewing `job.log()`/`flowElement.log()`/`job.fail()`/`failProcess()` calls"
8
+ ---
9
+
1
10
  # Logging Practices
2
11
 
3
12
  Guidance for using `job.log()`, `flowElement.log()`, `job.fail()`, and `flowElement.failProcess()`
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: switch
3
+ category: switch-api
4
+ order: 3
5
+ summary: "`Switch` (`s`): global data, webhooks, abort, server utilities"
6
+ triggers:
7
+ - "Using global data, webhooks, abort, or server settings"
8
+ ---
9
+
1
10
  # Switch Class
2
11
 
3
12
  The `Switch` instance `s` is passed to every entry point. It provides global data storage, webhook subscription, abort handling, and server utilities.
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: app-guidelines
3
+ category: switch-appstore
4
+ order: 20
5
+ summary: "Pre-publish checklist for Appstore apps: property naming/tooltips/editors, entry point and sendTo consistency, logging quality, packaging, and the app-only submission rules (localization, signed universal macOS binaries)"
6
+ triggers:
7
+ - "Preparing a script for publication as an app, or reviewing one against Appstore submission criteria"
8
+ ---
9
+
1
10
  # App Publishing Guidelines
2
11
 
3
12
  A pre-publish checklist for a script intended for the Enfocus Appstore (`ScriptPackageType="App"`
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: app-manual
3
+ category: switch-appstore
4
+ order: 23
5
+ summary: "Writing guidance for the separate app manual document uploaded during Appstore review (`documentation-app_name.docx` template)"
6
+ triggers:
7
+ - "Preparing the app manual document for Appstore submission"
8
+ ---
9
+
1
10
  # Writing the App Manual
2
11
 
3
12
  Guidance for the separate Word/PDF document an app creator uploads during Appstore review,
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: app-store-listing
3
+ category: switch-appstore
4
+ order: 22
5
+ summary: "Writing guidance for the declaration's Appstore listing fields: `Description`, `Compatibility`, `SupportInfo`, `AppDiscovery`, `Connections`"
6
+ triggers:
7
+ - "Writing or reviewing the app's Appstore listing text"
8
+ ---
9
+
1
10
  # Writing the Appstore Listing Fields
2
11
 
3
12
  Guidance for the *content* of the declaration's prose fields that appear on the app's Enfocus
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: app-store-submission
3
+ category: switch-appstore
4
+ order: 24
5
+ summary: "Writing guidance for the Create Appstore App / Create Appstore App Version web forms: Short Description, What's new, Eula, icon specs, and which fields reuse content already written elsewhere"
6
+ triggers:
7
+ - "Preparing content for the Appstore website submission forms"
8
+ ---
9
+
1
10
  # Writing the Appstore Submission Forms
2
11
 
3
12
  Guidance for the two web forms on the Enfocus Appstore site: **Create Appstore App** (once per
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: debugging
3
+ category: switch-project
4
+ order: 12
5
+ summary: "Enabling debug mode in Switch Designer, debuggable entry points, VS Code attach"
6
+ triggers:
7
+ - "Debugging a script"
8
+ ---
9
+
1
10
  # Debugging Scripts
2
11
 
3
12
  Debugging requires configuring the Script element in Switch Designer — the agent cannot do this directly but can guide the user through the steps.
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: logs-and-dataroot
3
+ category: switch-project
4
+ order: 19
5
+ summary: "Locating the Application Data Root, querying `ServerLogs.db3` directly"
6
+ triggers:
7
+ - "Diagnosing or validating a script from its actual log output rather than by reading the code"
8
+ ---
9
+
1
10
  # Locating and Querying Switch's Log Database
2
11
 
3
12
  For diagnosing or validating a script from the outside — reading what the user themselves would see
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: project-planning
3
+ category: switch-project
4
+ order: 1
5
+ summary: "Pre-scaffolding checklist: Script vs App, job-processing approach, target OS, Switch version baseline, concurrency, native/binary npm dependencies, Appstore competition risk"
6
+ triggers:
7
+ - "Starting a new script or app, before scaffolding any files"
8
+ ---
9
+
1
10
  # Project Planning
2
11
 
3
12
  A pre-scaffolding checklist for a new script or app. Work through this with the user before
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: property-documentation
3
+ category: switch-project
4
+ order: 21
5
+ summary: "Writing guidance for `Tooltip` and `DetailedInfo` content on properties/connections"
6
+ triggers:
7
+ - "Writing or reviewing the text in a property's or connection's `Tooltip`/`DetailedInfo`"
8
+ ---
9
+
1
10
  # Writing Property and Connection Documentation
2
11
 
3
12
  Guidance for the *content* of `Tooltip` and `DetailedInfo` on properties and connections — see
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: property-editors
3
+ category: switch-project
4
+ order: 15
5
+ summary: "Property editor types, string return values, literal editors, dropdowns"
6
+ triggers:
7
+ - "Defining property editors in XML or reading property values in code"
8
+ ---
9
+
1
10
  # Property Editors
2
11
 
3
12
  Property editors determine how a user enters a value in Switch Designer, and what string is
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: script-declaration
3
+ category: switch-project
4
+ order: 14
5
+ summary: "XML declaration reference: properties, connections, execution config; agents may edit this file directly"
6
+ triggers:
7
+ - "Understanding, adding, or editing script properties/connections/execution config"
8
+ ---
9
+
1
10
  # Script Declaration (XML)
2
11
 
3
12
  The file `<ScriptID>.xml` defines the script's metadata, custom properties, connection properties,
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: script-structure
3
+ category: switch-project
4
+ order: 10
5
+ summary: "What files a script folder contains, `manifest.xml` format, Node.js version per Switch release, Script vs App"
6
+ triggers:
7
+ - "Setting up a new script project, or converting a Script to an App"
8
+ ---
9
+
1
10
  # Script Project Structure
2
11
 
3
12
  A Switch script project lives in a **script folder** during development and is distributed as a `.sscript` package (ZIP).
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: tooling
3
+ category: switch-project
4
+ order: 11
5
+ summary: "SwitchScriptTool commands and install paths, folder vs `.sscript` trade-offs, deployment"
6
+ triggers:
7
+ - "Running SwitchScriptTool: transpiling, packing, unpacking, or deploying"
8
+ ---
9
+
1
10
  # Script Folders, Packages & SwitchScriptTool
2
11
 
3
12
  ## Script folder vs script package
@@ -1,3 +1,12 @@
1
+ ---
2
+ id: vscode
3
+ category: switch-project
4
+ order: 13
5
+ summary: "Type declarations, tsconfig for TypeScript 6, ESLint rules"
6
+ triggers:
7
+ - "Setting up VS Code or fixing type errors"
8
+ ---
9
+
1
10
  # VS Code Setup
2
11
 
3
12
  ## Type declarations
@@ -7,25 +7,27 @@ Enfocus Switch workflow automation scripts written in TypeScript/Node.js.
7
7
  - Type declarations are in `node_modules/@types/switch-scripting/index.d.ts` and must be followed precisely.
8
8
 
9
9
  ## API reference
10
- Detailed docs live in three folders: `docs/switch-api/` (the scripting API itself), `docs/switch-project/`
11
- (script/app project structure and tooling), and `docs/switch-appstore/` (Appstore publishing guidance).
10
+ Detailed docs live in three folders, alongside this file: `switch-api/` (the scripting API itself),
11
+ `switch-project/` (script/app project structure and tooling), and `switch-appstore/` (Appstore
12
+ publishing guidance).
12
13
 
13
14
  | File | Contents | Load when |
14
15
  |---|---|---|
16
+ <!-- docs-index:table begin -->
15
17
  | `switch-project/project-planning.md` | Pre-scaffolding checklist: Script vs App, job-processing approach, target OS, Switch version baseline, concurrency, native/binary npm dependencies, Appstore competition risk | Starting a new script or app, before scaffolding any files |
16
18
  | `switch-api/entry-points.md` | All entry point signatures, constraints, and when each is called | Scaffolding a script, adding/editing an entry point, or making any edit to main.ts/main.js |
17
- | `switch-api/switch.md` | `Switch` (`s`) — global data, webhooks, abort, server utilities | Using global data, webhooks, abort, or server settings |
18
- | `switch-api/flow-element.md` | `FlowElement` — properties, connections, job creation, logging | Reading properties, creating jobs, logging, connections |
19
+ | `switch-api/switch.md` | `Switch` (`s`): global data, webhooks, abort, server utilities | Using global data, webhooks, abort, or server settings |
20
+ | `switch-api/flow-element.md` | `FlowElement`: properties, connections, job creation, logging | Reading properties, creating jobs, logging, connections |
19
21
  | `switch-api/job.md` | `Job` **signatures**: routing, file access, child jobs, private data, datasets | Looking up what a `job.*` method takes, returns, or throws |
20
- | `switch-api/connection.md` | `Connection` — type, properties, file count | Routing to specific connections or reading connection properties |
22
+ | `switch-api/connection.md` | `Connection`: type, properties, file count | Routing to specific connections or reading connection properties |
21
23
  | `switch-api/http.md` | `HttpRequest` / `HttpResponse` + webhook pattern | Handling incoming HTTP webhooks |
22
24
  | `switch-api/enums.md` | All enums with string values (`LogLevel`, `AccessLevel`, `DatasetModel`, `Scope`, `Priority`, `Connection.Level`, etc.) | Looking up enum values |
23
- | `switch-api/document-classes.md` | `PdfDocument`, `PdfPage`, `ImageDocument`, `XmlDocument`, `XmpDocument` — read-only file introspection | Inspecting PDF, image, XML, or XMP file contents |
25
+ | `switch-api/document-classes.md` | `PdfDocument`, `PdfPage`, `ImageDocument`, `XmlDocument`, `XmpDocument`: read-only file introspection | Inspecting PDF, image, XML, or XMP file contents |
24
26
  | `switch-project/script-structure.md` | What files a script folder contains, `manifest.xml` format, Node.js version per Switch release, Script vs App | Setting up a new script project, or converting a Script to an App |
25
27
  | `switch-project/tooling.md` | SwitchScriptTool commands and install paths, folder vs `.sscript` trade-offs, deployment | Running SwitchScriptTool: transpiling, packing, unpacking, or deploying |
26
28
  | `switch-project/debugging.md` | Enabling debug mode in Switch Designer, debuggable entry points, VS Code attach | Debugging a script |
27
29
  | `switch-project/vscode.md` | Type declarations, tsconfig for TypeScript 6, ESLint rules | Setting up VS Code or fixing type errors |
28
- | `switch-project/script-declaration.md` | XML declaration reference: properties, connections, execution config — agents may edit this file directly | Understanding, adding, or editing script properties/connections/execution config |
30
+ | `switch-project/script-declaration.md` | XML declaration reference: properties, connections, execution config; agents may edit this file directly | Understanding, adding, or editing script properties/connections/execution config |
29
31
  | `switch-project/property-editors.md` | Property editor types, string return values, literal editors, dropdowns | Defining property editors in XML or reading property values in code |
30
32
  | `switch-api/job-patterns.md` | `Job` **rules and gotchas**: file access semantics, temp cleanup, which `sendTo*()` suits which connection type, dataset/child ordering, executor limits | Writing or reviewing job-handling code. Pair with `job.md` when you also need signatures |
31
33
  | `switch-api/execution-environment.md` | Execution modes (`Concurrent`/`Serialized`, `ExecutionGroup`, `NumberOfSlots`), process/concurrency model, state persistence across job invocations, unhandled-rejection behavior, npm/native module constraints | Choosing or changing an execution mode, relying on module-level state across jobs, handling errors/rejections, or using third-party npm packages |
@@ -36,13 +38,14 @@ Detailed docs live in three folders: `docs/switch-api/` (the scripting API itsel
36
38
  | `switch-appstore/app-store-listing.md` | Writing guidance for the declaration's Appstore listing fields: `Description`, `Compatibility`, `SupportInfo`, `AppDiscovery`, `Connections` | Writing or reviewing the app's Appstore listing text |
37
39
  | `switch-appstore/app-manual.md` | Writing guidance for the separate app manual document uploaded during Appstore review (`documentation-app_name.docx` template) | Preparing the app manual document for Appstore submission |
38
40
  | `switch-appstore/app-store-submission.md` | Writing guidance for the Create Appstore App / Create Appstore App Version web forms: Short Description, What's new, Eula, icon specs, and which fields reuse content already written elsewhere | Preparing content for the Appstore website submission forms |
41
+ <!-- docs-index:table end -->
39
42
 
40
43
  ## Key rules
41
44
  - Before scaffolding a new script or app, work through `switch-project/project-planning.md` with the user.
42
45
  - Always consult the API reference files above before writing or modifying script code.
43
- - To find documented behavioural pitfalls before writing code in an area, grep `docs/switch-api/`,
44
- `docs/switch-project/`, and `docs/switch-appstore/` for `known issue`, `gotcha`, `quirk`, `caveat`
45
- (case-insensitive) — every documented pitfall uses one of these four terms.
46
+ - To find documented behavioural pitfalls before writing code in an area, grep the `switch-api/`,
47
+ `switch-project/`, and `switch-appstore/` folders alongside this file for `known issue`, `gotcha`,
48
+ `quirk`, `caveat` (case-insensitive) — every documented pitfall uses one of these four terms.
46
49
  - Do not `export` entry point functions. Declare them with the literal `function` keyword at top
47
50
  level — arrow functions, `exports.name = ...`, and class methods are invisible to Switch.
48
51
  - Switch discovers entry points with a regex, not a parser. Never write a string literal whose
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfocussw/switch-scripting-context",
3
- "version": "25.11.0-beta.15",
3
+ "version": "25.11.0-beta.17",
4
4
  "description": "AI coding assistant context for Enfocus Switch scripting (Node.js/TypeScript)",
5
5
  "keywords": [
6
6
  "switch",
@@ -33,11 +33,12 @@
33
33
  "scripts": {
34
34
  "build": "tsc -p tsconfig.json",
35
35
  "build:test": "tsc src/init.test.ts --outDir dist --target ES2020 --module commonjs --lib ES2020 --types node --strict --esModuleInterop --skipLibCheck",
36
- "test": "npm run build && npm run build:test && node dist/init.test.js && node scripts/check-prose.js && node scripts/check-gotcha-tags.js",
36
+ "test": "npm run build && npm run build:test && node dist/init.test.js && node scripts/check-prose.js && node scripts/check-gotcha-tags.js && node scripts/generate-docs-index.js --check",
37
37
  "prepack": "npm run build && node scripts/readme-links.js --publish",
38
38
  "postpack": "node scripts/readme-links.js --restore && node -e \"const fs=require('fs');const version=process.env.npm_package_version;const scoped=process.env.npm_package_name.replace(/^@/,'').replace('/','-')+'-'+version+'.tgz';const unscoped=process.env.npm_package_name.replace(/^@[^/]+\\//,'')+'-'+version+'.tgz';if(scoped!==unscoped&&fs.existsSync(scoped))fs.renameSync(scoped,unscoped);\"",
39
39
  "lint:prose": "node scripts/check-prose.js",
40
- "lint:gotchas": "node scripts/check-gotcha-tags.js"
40
+ "lint:gotchas": "node scripts/check-gotcha-tags.js",
41
+ "docs:generate": "node scripts/generate-docs-index.js"
41
42
  },
42
43
  "author": "Sam Wallace",
43
44
  "license": "ISC",