@enfocussw/switch-scripting-context 25.11.0-beta.15 → 25.11.0-beta.16
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 +19 -0
- package/README.md +26 -24
- package/docs/switch-api/connection.md +16 -1
- package/docs/switch-api/document-classes.md +9 -0
- package/docs/switch-api/entry-points.md +9 -0
- package/docs/switch-api/enums.md +12 -1
- package/docs/switch-api/execution-environment.md +9 -0
- package/docs/switch-api/flow-element.md +9 -0
- package/docs/switch-api/http.md +9 -0
- package/docs/switch-api/job-patterns.md +15 -0
- package/docs/switch-api/job.md +9 -0
- package/docs/switch-api/logging.md +9 -0
- package/docs/switch-api/switch.md +9 -0
- package/docs/switch-appstore/app-guidelines.md +9 -0
- package/docs/switch-appstore/app-manual.md +9 -0
- package/docs/switch-appstore/app-store-listing.md +9 -0
- package/docs/switch-appstore/app-store-submission.md +9 -0
- package/docs/switch-project/debugging.md +9 -0
- package/docs/switch-project/logs-and-dataroot.md +9 -0
- package/docs/switch-project/project-planning.md +9 -0
- package/docs/switch-project/property-documentation.md +9 -0
- package/docs/switch-project/property-editors.md +9 -0
- package/docs/switch-project/script-declaration.md +9 -0
- package/docs/switch-project/script-structure.md +9 -0
- package/docs/switch-project/tooling.md +9 -0
- package/docs/switch-project/vscode.md +9 -0
- package/docs/switch-scripting.md +13 -10
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.16] - 2026-09-10
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Connection docs clarify that traffic light levels (`Connection.Level.Success`/`Warning`/`Error`)
|
|
12
|
+
only select where `sendToData()`/`sendToLog()` route a job; they cannot be read back from a
|
|
13
|
+
connection object, and `sendToData()` fails the job if no connected level matches. Scripts that
|
|
14
|
+
need optional traffic light routing should expose a custom property and fall back to
|
|
15
|
+
`sendToNull()`.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- `switch-scripting.md`'s own text told agents to grep a `docs/` prefix that only exists in this
|
|
19
|
+
repo's source tree, not in a consuming project's copied docs folder. Agents following that
|
|
20
|
+
instruction literally hit a folder that doesn't exist. The text now describes the copied layout.
|
|
21
|
+
|
|
6
22
|
## [25.11.0-beta.15] - 2026-09-10
|
|
7
23
|
|
|
8
24
|
### Added
|
|
@@ -18,6 +34,9 @@ All notable changes to this package are documented here. Format follows
|
|
|
18
34
|
`docs/switch-appstore/`. Update any bookmarked doc paths after upgrading.
|
|
19
35
|
- Dropped the `api-` prefix from doc filenames, for example `switch-api/job.md`, since each file's
|
|
20
36
|
folder already says what kind of doc it is.
|
|
37
|
+
- Each doc file now carries its own routing metadata (trigger and summary) as YAML frontmatter,
|
|
38
|
+
generated into the routing table and README's doc list instead of hand-duplicated in both.
|
|
39
|
+
README's descriptions now match the table's wording exactly; a few had drifted apart.
|
|
21
40
|
|
|
22
41
|
### Fixed
|
|
23
42
|
- `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.
|
|
7
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.0-beta.16/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.
|
|
87
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.0-beta.16/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
|
-
|
|
135
|
-
- `switch-
|
|
136
|
-
- `switch-api/
|
|
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/
|
|
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`
|
|
141
|
-
- `switch-api/enums.md`:
|
|
142
|
-
- `switch-api/document-classes.md`: `PdfDocument`, `ImageDocument`, `XmlDocument`, `XmpDocument
|
|
143
|
-
- `switch-project/script-
|
|
144
|
-
- `switch-project/
|
|
145
|
-
- `switch-project/
|
|
146
|
-
- `switch-project/
|
|
147
|
-
- `switch-
|
|
148
|
-
- `switch-project/
|
|
149
|
-
- `switch-
|
|
150
|
-
- `switch-
|
|
151
|
-
- `switch-api/
|
|
152
|
-
- `switch-
|
|
153
|
-
- `switch-appstore/app-guidelines.md`:
|
|
154
|
-
- `switch-project/property-documentation.md`:
|
|
155
|
-
- `switch-appstore/app-store-listing.md`:
|
|
156
|
-
- `switch-appstore/app-manual.md`:
|
|
157
|
-
- `switch-appstore/app-store-submission.md`:
|
|
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()`.
|
|
@@ -52,7 +61,7 @@ Returns the number of files in the folder at the other end of this connection. I
|
|
|
52
61
|
|
|
53
62
|
## Connection.Level enum
|
|
54
63
|
|
|
55
|
-
Used with `job.sendToData()` and `job.sendToLog()`
|
|
64
|
+
Used with `job.sendToData()` and `job.sendToLog()` to select which traffic light connection a job routes to.
|
|
56
65
|
|
|
57
66
|
| Value | String |
|
|
58
67
|
|---|---|
|
|
@@ -61,3 +70,9 @@ Used with `job.sendToData()` and `job.sendToLog()` for traffic light connections
|
|
|
61
70
|
| `Connection.Level.Error` | `"error"` |
|
|
62
71
|
|
|
63
72
|
Available as `EnfocusSwitch.Connection.Level.*` outside `main.ts`.
|
|
73
|
+
|
|
74
|
+
**Traffic light levels are not a readable connection property.** `flowElement.getOutConnections()`
|
|
75
|
+
returns the outgoing `Connection` objects, but the supported API has no way to determine which
|
|
76
|
+
level(s) a given connection accepts. Don't call `connection.getPropertyStringValue("Success")`, `"Warning"`, or `"Error"` expecting to
|
|
77
|
+
read this back; those are not valid property tags for a traffic light connection. To route
|
|
78
|
+
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.
|
package/docs/switch-api/enums.md
CHANGED
|
@@ -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.
|
package/docs/switch-api/http.md
CHANGED
|
@@ -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
|
package/docs/switch-api/job.md
CHANGED
|
@@ -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`).
|
|
@@ -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
|
package/docs/switch-scripting.md
CHANGED
|
@@ -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: `
|
|
11
|
-
(script/app project structure and tooling), and `
|
|
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`)
|
|
18
|
-
| `switch-api/flow-element.md` | `FlowElement
|
|
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
|
|
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
|
|
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
|
|
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 `
|
|
44
|
-
`
|
|
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.
|
|
3
|
+
"version": "25.11.0-beta.16",
|
|
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",
|