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

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 (30) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/README.md +40 -35
  3. package/dist/init.d.ts +1 -1
  4. package/dist/init.js +18 -7
  5. package/docs/switch-api/{api-connection.md → connection.md} +2 -2
  6. package/docs/switch-api/{api-document-classes.md → document-classes.md} +1 -1
  7. package/docs/switch-api/{api-entry-points.md → entry-points.md} +15 -5
  8. package/docs/switch-api/{api-execution-environment.md → execution-environment.md} +7 -7
  9. package/docs/switch-api/{api-flow-element.md → flow-element.md} +4 -4
  10. package/docs/switch-api/{api-job-patterns.md → job-patterns.md} +8 -8
  11. package/docs/switch-api/{api-job.md → job.md} +4 -4
  12. package/docs/switch-api/{api-logging.md → logging.md} +6 -6
  13. package/docs/switch-api/{api-switch.md → switch.md} +1 -1
  14. package/docs/{switch-api/api-app-guidelines.md → switch-appstore/app-guidelines.md} +41 -33
  15. package/docs/switch-appstore/app-manual.md +75 -0
  16. package/docs/switch-appstore/app-store-listing.md +60 -0
  17. package/docs/switch-appstore/app-store-submission.md +74 -0
  18. package/docs/{switch-api/api-logs-and-dataroot.md → switch-project/logs-and-dataroot.md} +1 -1
  19. package/docs/switch-project/project-planning.md +100 -0
  20. package/docs/switch-project/property-documentation.md +66 -0
  21. package/docs/{switch-api/api-property-editors.md → switch-project/property-editors.md} +10 -10
  22. package/docs/{switch-api/api-script-declaration.md → switch-project/script-declaration.md} +9 -9
  23. package/docs/{switch-api/api-script-structure.md → switch-project/script-structure.md} +5 -5
  24. package/docs/{switch-api/api-tooling.md → switch-project/tooling.md} +1 -1
  25. package/docs/switch-scripting.md +32 -22
  26. package/package.json +7 -4
  27. /package/docs/switch-api/{api-enums.md → enums.md} +0 -0
  28. /package/docs/switch-api/{api-http.md → http.md} +0 -0
  29. /package/docs/{switch-api/api-debugging.md → switch-project/debugging.md} +0 -0
  30. /package/docs/{switch-api/api-vscode.md → switch-project/vscode.md} +0 -0
@@ -3,18 +3,18 @@
3
3
  Property editors determine how a user enters a value in Switch Designer, and what string is
4
4
  returned by `getPropertyStringValue()` at runtime. They're set in the XML declaration via the
5
5
  `Editor` and `Type` attributes on a custom property — see
6
- [api-script-declaration.md](api-script-declaration.md) for the surrounding attribute grammar.
6
+ [script-declaration.md](script-declaration.md) for the surrounding attribute grammar.
7
7
 
8
8
  All property values are returned as `string` or `string[]`. `getPropertyType()` returns one of a
9
9
  fixed set of `PropertyType` values (`literal`, `string`, `number`, `date`, `boolean`, `filepath`,
10
- `folderpath`, `regex`, `oauthtoken`, etc. — see [api-enums.md](api-enums.md)) describing what kind of
10
+ `folderpath`, `regex`, `oauthtoken`, etc. — see [enums.md](../switch-api/enums.md)) describing what kind of
11
11
  value is actually present; `literal` is only one of these, not a binary "literal vs. user-entered"
12
12
  flag. Use it before interpreting the returned string, e.g. to check for a literal editor's constant
13
13
  before comparing it.
14
14
 
15
15
  `Editor` is a `;`-joined list: the inline editor's token (if any) first, then modal editor tokens in
16
16
  the order they're offered. `Type` follows from which editor(s) are chosen — see the tables below and
17
- [the Type reference](api-script-declaration.md#type-reference).
17
+ [the Type reference](script-declaration.md#type-reference).
18
18
 
19
19
  ---
20
20
 
@@ -48,8 +48,8 @@ open a dialog when the user clicks the editor button. All have `Type="string"` u
48
48
  | `regexp` | Regular expression string as entered |
49
49
  | `filetype` | Filename pattern(s) for the selected file type |
50
50
  | `types` (`Type="filefilter"`) | `string[]` — one pattern string per selected file type |
51
- | `askplugin` | String value selected from the library dialog (calls `getLibraryForProperty`) — **requires the script to implement `getLibraryForProperty`** (`getLibraryForConnectionProperty` for a connection field), see [api-entry-points.md](api-entry-points.md#property-ui-callbacks) |
52
- | `askplugin2` | `string[]` — one string per selected library item (calls `getLibraryForMultipleProperty`) — **requires a matching library-callback entry point**, same as `askplugin` above. ⚠ `getLibraryForMultipleProperty` isn't documented anywhere in [api-entry-points.md](api-entry-points.md#property-ui-callbacks), which only lists `getLibraryForProperty`/`getLibraryForConnectionProperty` — this may be the same entry point handling both single- and multi-select, or a genuinely separate, undocumented one; needs verifying against source before relying on the name here. |
51
+ | `askplugin` | String value selected from the library dialog (calls `getLibraryForProperty`) — **requires the script to implement `getLibraryForProperty`** (`getLibraryForConnectionProperty` for a connection field), see [entry-points.md](../switch-api/entry-points.md#property-ui-callbacks) |
52
+ | `askplugin2` | `string[]` — one string per selected library item (calls `getLibraryForMultipleProperty`) — **requires a matching library-callback entry point**, same as `askplugin` above. ⚠ `getLibraryForMultipleProperty` isn't documented anywhere in [entry-points.md](../switch-api/entry-points.md#property-ui-callbacks), which only lists `getLibraryForProperty`/`getLibraryForConnectionProperty` — this may be the same entry point handling both single- and multi-select, or a genuinely separate, undocumented one; needs verifying against source before relying on the name here. |
53
53
  | `description` | Multi-line text as a single string (may include newlines) |
54
54
  | `scriptexp` | Result of script expression evaluated in job context, as a string |
55
55
  | `sltextwithvar` | Single-line text with variables substituted, as a string |
@@ -58,7 +58,7 @@ open a dialog when the user clicks the editor button. All have `Type="string"` u
58
58
  | `filepatterns` | `string[]` — one pattern string per entry |
59
59
  | `folderpatterns` | `string[]` — one pattern string per entry |
60
60
  | `stringlist` (`Type="stringlist"`) | `string[]` — one string per line |
61
- | `oauth` | OAuth 2.0 access token string, or `""` if not yet authorized — see [ExtraProperties](api-script-declaration.md#extraproperties) |
61
+ | `oauth` | OAuth 2.0 access token string, or `""` if not yet authorized — see [ExtraProperties](script-declaration.md#extraproperties) |
62
62
  | `external`, `external2`, … | File path to a property set edited by an external companion app |
63
63
 
64
64
  > Duplicate tokens in `Editor` are meaningless — each modal editor can only be offered once, except
@@ -157,7 +157,7 @@ offer it as the property's only editor — pair it with a module-free option (e.
157
157
  | Boolean consumed directly by script logic (not a `Dependency` master) | `inline` + `conditionwithvar` + `scriptexp` | Safe to toggle dynamically since nothing else depends on it for visibility. Also covers booleans that are themselves a `Dependency` *dependent* (not a master). |
158
158
  | Enum (`Type="enum:..."`) | `inline` only, always | No editor guarantees a var/expression result matches one of the declared items. |
159
159
  | File/folder path that must exist for the app to work | `choosefile`/`choosefolder` only | Switch validates the picked path exists at flow start. |
160
- | File/folder path that legitimately varies per job | `choosefile`/`choosefolder` + `sltextwithvar` + `scriptexp` | Dynamic values only resolve when read during `jobArrived` — see the "Workaround for deferred processing" note in [api-flow-element.md](api-flow-element.md#properties) if the path is needed later in the flow. |
160
+ | File/folder path that legitimately varies per job | `choosefile`/`choosefolder` + `sltextwithvar` + `scriptexp` | Dynamic values only resolve when read during `jobArrived` — see the "Workaround for deferred processing" note in [flow-element.md](../switch-api/flow-element.md#properties) if the path is needed later in the flow. |
161
161
  | Connection include-mask filter (which jobs pass through) | `allfiles;allotherfiles;types;filepatterns;regexp;scriptexp`, `Default="All Files"`, `Subtype="allfiles"` | Matches Switch's own built-in connection filter properties exactly — `Default`/`Subtype` must hold the chosen literal's exact rendered string. Folder version: `allfolders;allotherfolders;folderpatterns;regexp;scriptexp` with `Default="All Folders"`, `Subtype="allfolders"`. |
162
162
  | Connection exclude-mask filter (which jobs are blocked) | `nofiles;types;filepatterns;regexp;scriptexp`, `Default="No Files"`, `Subtype="nofiles"` | Same reasoning as the include mask, starting from `nofiles` instead since there's no "exclude all/all other" case. Folder version: `nofolders;folderpatterns;regexp;scriptexp` with `Default="No Folders"`, `Subtype="nofolders"`. |
163
163
 
@@ -171,12 +171,12 @@ dedicated row above.
171
171
 
172
172
  - **OAuth 2.0**: endpoint, client ID/secret, scope, and redirect ports are configured per-property
173
173
  in a matching `<ExtraProperties>` child element (see
174
- [api-script-declaration.md § ExtraProperties](api-script-declaration.md#extraproperties)), not in
174
+ [script-declaration.md § ExtraProperties](script-declaration.md#extraproperties)), not in
175
175
  `Editor`/`Type`. The script receives a ready-to-use access token string via
176
176
  `getPropertyStringValue()`.
177
177
  - **External editor**: requires a separate companion application. The script receives a file path to
178
178
  the property set file. Entry point `findExternalEditorPath` resolves the editor executable path.
179
179
  One of these two must be true — either a dependent property named `Application` (see
180
- [Dependency](api-script-declaration.md#custom-property-elements-elementfields)) is non-empty, or
180
+ [Dependency](script-declaration.md#custom-property-elements-elementfields)) is non-empty, or
181
181
  the script implements `findExternalEditorPath` — see
182
- [api-entry-points.md](api-entry-points.md#property-ui-callbacks).
182
+ [entry-points.md](../switch-api/entry-points.md#property-ui-callbacks).
@@ -57,8 +57,8 @@ value is non-string (see the table); an empty string field can omit `Type`.
57
57
  | `Version` | number | Format `[1-9][0-9]*(\.(0\|[1-9][0-9]*))*`, e.g. `1`, `2.1`. Bump on every declaration change. |
58
58
  | `Keywords` | string | Space/comma/semicolon-separated. Elements pane search. |
59
59
  | `Tooltip` | string | Elements pane tooltip. |
60
- | `IncomingConnections` | `Yes` \| `No` | Add `RequireAtLeastOne="Yes"` when `Yes`. When `Yes`, the script must implement `jobArrived` (optionally `timerFired` too); when `No`, it must implement `timerFired` instead — see [api-entry-points.md](api-entry-points.md#job-processing). |
61
- | `OutgoingConnections` | `No` \| `One` \| `Unlimited` | Add `RequireAtLeastOne="Yes"` when `One`/`Unlimited`. Always carries `DetailedInfo=""` (or a prose description of the connections, for generated docs). When not `No`, the script must call a `sendTo*()` method at least once for any job it actually routes (a purely timer/event-driven script that never touches a job — polling an API, rotating logs, etc. — is a legitimate exception); when `Unlimited`, never use `job.sendToSingle()` — see [api-job-patterns.md § Sending jobs](api-job-patterns.md#sending-jobs). |
60
+ | `IncomingConnections` | `Yes` \| `No` | Add `RequireAtLeastOne="Yes"` when `Yes`. When `Yes`, the script must implement `jobArrived` (optionally `timerFired` too); when `No`, it must implement `timerFired` instead — see [entry-points.md](../switch-api/entry-points.md#job-processing). |
61
+ | `OutgoingConnections` | `No` \| `One` \| `Unlimited` | Add `RequireAtLeastOne="Yes"` when `One`/`Unlimited`. Always carries `DetailedInfo=""` (or a prose description of the connections, for generated docs). When not `No`, the script must call a `sendTo*()` method at least once for any job it actually routes (a purely timer/event-driven script that never touches a job — polling an API, rotating logs, etc. — is a legitimate exception); when `Unlimited`, never use `job.sendToSingle()` — see [job-patterns.md § Sending jobs](../switch-api/job-patterns.md#sending-jobs). |
62
62
  | `ConnectionType` | `Move` \| `Filter` \| `TrafficLight` | Governs which `ConnectionFields` children are legal — see [ConnectionFields](#connectionfields). |
63
63
  | `FunctionsNodeJSScript` | `;`-separated names | Entry point function names found in the script. Omit the element entirely if there is no Node.js program. |
64
64
  | `ExecutionMode` | `Concurrent` \| `Serialized` | |
@@ -108,12 +108,12 @@ Key attributes:
108
108
  |---|---|
109
109
  | `UserDefined` | Always `"true"` for custom properties. |
110
110
  | `Type` | Value type discriminator — see [Type reference](#type-reference). |
111
- | `Editor` | `;`-joined chain of editor tokens (inline editor first, then modal editors) — see [api-property-editors.md](api-property-editors.md). |
111
+ | `Editor` | `;`-joined chain of editor tokens (inline editor first, then modal editors) — see [property-editors.md](property-editors.md). |
112
112
  | `Subtype` | Which editor in the `Editor` chain is currently active for the stored value. For a single-editor property this equals that editor's token (e.g. `"inline"`); for a bare modal editor with no inline component, leave it `""`. This attribute is read by Switch's validator at runtime, not just bookkeeping — keep it consistent with `Editor`. |
113
113
  | `LocalizedTagName` | Display name shown in the Properties pane. **App guideline (mandatory for apps, recommended for scripts):** 30 characters max, sentence-style capitalization (`"Customer name"`, not `"Customer Name"`). |
114
114
  | `Tooltip` | Tooltip shown in the Properties pane. **App guideline (mandatory for apps, recommended for scripts):** give every property a tooltip. The only exception is a property that's fully self-explanatory from its name alone with no extra constraints (e.g. "Number of copies" with no min/max) — if there's anything a user would need to know (units, valid range, format, an example value), put it in the tooltip. |
115
115
  | `DetailedInfo` | Long-form description for generated docs. Always include the attribute (empty string `""` is fine) — omitting it makes the property non-editable in Switch Designer. |
116
- | `Validation` | `None` (skip validation) \| `Standard` (built-in validator) \| `Custom` (needs a `validateProperties` entry point) \| `Standard and custom` (both, custom only runs if standard passes). If any property uses `Custom` or `Standard and custom`, the script must implement `validateProperties` (or `validateConnectionProperties` for a connection field) — see [api-entry-points.md](api-entry-points.md#property-ui-callbacks). To let a property hold an empty value under `Standard` validation, add the `none` literal editor to the `Editor` chain (see [api-property-editors.md § Literal editors](api-property-editors.md#literal-editors)) instead of relaxing to `Validation="None"` just to permit emptiness. |
116
+ | `Validation` | `None` (skip validation) \| `Standard` (built-in validator) \| `Custom` (needs a `validateProperties` entry point) \| `Standard and custom` (both, custom only runs if standard passes). If any property uses `Custom` or `Standard and custom`, the script must implement `validateProperties` (or `validateConnectionProperties` for a connection field) — see [entry-points.md](../switch-api/entry-points.md#property-ui-callbacks). To let a property hold an empty value under `Standard` validation, add the `none` literal editor to the `Editor` chain (see [property-editors.md § Literal editors](property-editors.md#literal-editors)) instead of relaxing to `Validation="None"` just to permit emptiness. |
117
117
  | `Default` | Default value string. Omit only if the value is emitted as CDATA instead. **App guideline (mandatory for apps, recommended for scripts):** always provide a default unless there's genuinely no sensible one; if a default truly isn't possible, give an example value in the `Tooltip` instead. |
118
118
  | `Dependency` | Tag of the master property this one depends on. Written flat (not nested) — the dependent element is a sibling of its master, not a child. |
119
119
  | `DependencyCondition` | One of: `Not-empty`, `Equals`, `Not-equals`, `Contains`, `Does not contain`, `Matches`, `Does not match`, `Starts with`, `Does not start with`. |
@@ -134,7 +134,7 @@ Key attributes:
134
134
  **Runtime pitfall:** when a dependent property is hidden (its master's current value doesn't satisfy
135
135
  `DependencyCondition`/`Dependencyvalue`), Switch treats the tag as if it doesn't exist. Calling
136
136
  `flowElement.getPropertyStringValue(tag)` on it throws `"Invalid tag: <tag>"` — see
137
- [api-flow-element.md](api-flow-element.md#properties). Only fetch a dependent property once you know
137
+ [flow-element.md](../switch-api/flow-element.md#properties). Only fetch a dependent property once you know
138
138
  its condition holds, either by checking the already-read master value yourself, or by calling
139
139
  `flowElement.hasProperty(tag)` first (it returns `false` for a hidden dependent). This matters most
140
140
  for an enum/drop-down master with several dependents keyed off different values — fetch only the
@@ -191,7 +191,7 @@ most important thing to get right when hand-editing this section:
191
191
  Custom (author-defined) connection properties may be added regardless of `ConnectionType`.
192
192
 
193
193
  The declared connections and the script's `sendTo*()` calls must agree with each other — see
194
- [api-job-patterns.md § Sending jobs](api-job-patterns.md#sending-jobs) for the exact rules per
194
+ [job-patterns.md § Sending jobs](../switch-api/job-patterns.md#sending-jobs) for the exact rules per
195
195
  `ConnectionType`. In particular, omit a `Success`/`Warning`/`Error` element entirely (as shown
196
196
  above) if the script never routes to it, rather than leaving an unused connection declared.
197
197
 
@@ -207,7 +207,7 @@ properties to reset on next package update.
207
207
  ## ExtraProperties
208
208
 
209
209
  Only used for OAuth 2.0 (`Editor` containing `oauth`, see
210
- [api-property-editors.md](api-property-editors.md)). One child element per OAuth property, named
210
+ [property-editors.md](property-editors.md)). One child element per OAuth property, named
211
211
  identically to the property's tag, in `ElementFields` or `ConnectionFields`:
212
212
 
213
213
  ```xml
@@ -259,7 +259,7 @@ If no OAuth property exists on the script, omit `ExtraProperties` entirely or le
259
259
 
260
260
  This is the *authoring* vocabulary written into the XML `Type` attribute. It does not map one-to-one
261
261
  onto the runtime `PropertyType` returned by `getPropertyType()` (see
262
- [api-property-editors.md](api-property-editors.md) and [api-enums.md](api-enums.md)) — e.g. XML
262
+ [property-editors.md](property-editors.md) and [enums.md](../switch-api/enums.md)) — e.g. XML
263
263
  `bool` becomes runtime `boolean`, XML `path` splits into runtime `filepath`/`folderpath`, and several
264
264
  XML types (`rational`, `stringlist`, `accountlist`, `enum:...`, `datetime`, `time`) have no direct
265
265
  `PropertyType` counterpart while several runtime values (`filetype`, `folderpattern`, `regex`,
@@ -267,7 +267,7 @@ XML types (`rational`, `stringlist`, `accountlist`, `enum:...`, `datetime`, `tim
267
267
  interchangeable.
268
268
 
269
269
  `Type` is not independently authored on properties with a modal editor chain — it follows from
270
- which editor(s) you choose, per [api-property-editors.md](api-property-editors.md). When combining
270
+ which editor(s) you choose, per [property-editors.md](property-editors.md). When combining
271
271
  an inline editor with modal editors (e.g. `Editor="inline;sltextwithvar;scriptexp"`), the inline
272
272
  editor's type wins: an inline Number editor plus those modal editors still yields `Type="number"`.
273
273
 
@@ -2,14 +2,14 @@
2
2
 
3
3
  A Switch script project lives in a **script folder** during development and is distributed as a `.sscript` package (ZIP).
4
4
 
5
- > **Agent editing policy**: Edit TypeScript/JavaScript source files (`main.ts`, `main.js`) and the XML declaration (`<ScriptID>.xml`) freely — see [api-script-declaration.md](api-script-declaration.md) for the declaration's rules, and [api-entry-points.md § Entry-point scanner constraints](api-entry-points.md#entry-point-scanner-constraints) before writing any string/regex literal or division, since certain shapes make Switch's entry-point scanner silently drop functions. Leave `manifest.xml` to the user unless explicitly asked.
5
+ > **Agent editing policy**: Edit TypeScript/JavaScript source files (`main.ts`, `main.js`) and the XML declaration (`<ScriptID>.xml`) freely — see [script-declaration.md](script-declaration.md) for the declaration's rules, and [entry-points.md § Entry-point scanner constraints](../switch-api/entry-points.md#entry-point-scanner-constraints) before writing any string/regex literal or division, since certain shapes make Switch's entry-point scanner silently drop functions. Leave `manifest.xml` to the user unless explicitly asked.
6
6
 
7
7
  ## Script folder files
8
8
 
9
9
  | File | Required | Notes |
10
10
  |---|---|---|
11
11
  | `manifest.xml` | Yes | Switch internal use only. Do not edit manually. |
12
- | `<ScriptID>.xml` | Yes | Script declaration (properties, connections, execution config). See [api-script-declaration.md](api-script-declaration.md). |
12
+ | `<ScriptID>.xml` | Yes | Script declaration (properties, connections, execution config). See [script-declaration.md](script-declaration.md). |
13
13
  | `main.ts` | Yes (TypeScript) | Source file. Edit this. |
14
14
  | `main.js` | Yes | Compiled output executed by Switch. Generated by transpiling `main.ts`. |
15
15
  | `main.js.map` | No | Source map, generated alongside `main.js`. |
@@ -105,13 +105,13 @@ testing before submission; it loads elsewhere only once Enfocus has signed it.
105
105
  ## App Store submission guidelines
106
106
 
107
107
  App-specific submission rules (localization, universal/signed macOS binaries, immutable extra
108
- files) live in [api-app-guidelines.md § App-only](api-app-guidelines.md#app-only), alongside the
108
+ files) live in [app-guidelines.md § App-only](../switch-appstore/app-guidelines.md#app-only), alongside the
109
109
  rest of the pre-publish checklist.
110
110
 
111
111
  ## Execution modes
112
112
 
113
113
  `Concurrent`/`Serialized`, `ExecutionGroup` and `NumberOfSlots` are set in the XML declaration (see
114
- [api-script-declaration.md](api-script-declaration.md#built-in-elementfields) for the attributes)
114
+ [script-declaration.md](script-declaration.md#built-in-elementfields) for the attributes)
115
115
  and documented in
116
- [api-execution-environment.md § Execution modes](api-execution-environment.md#execution-modes),
116
+ [execution-environment.md § Execution modes](../switch-api/execution-environment.md#execution-modes),
117
117
  which also explains why none of them maps to a count of Node.js processes.
@@ -44,7 +44,7 @@ location for the current OS if the bare command isn't found.
44
44
 
45
45
  Switch's entry-point scanner is regex-based, not a real parser, and can silently drop entry-point
46
46
  functions from certain string/regex/division shapes — see
47
- [api-entry-points.md § Entry-point scanner constraints](api-entry-points.md#entry-point-scanner-constraints).
47
+ [entry-points.md § Entry-point scanner constraints](../switch-api/entry-points.md#entry-point-scanner-constraints).
48
48
  `--pack` does not validate or warn about this: a script that packs cleanly can still fail to load,
49
49
  or load with a property callback that silently never runs. Compiling and passing tests doesn't
50
50
  catch it either, since the source is syntactically valid JS/TS — only extraction against the built
@@ -7,41 +7,51 @@ 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 API docs are in `docs/switch-api/`:
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).
11
12
 
12
13
  | File | Contents | Load when |
13
14
  |---|---|---|
14
- | `switch-api/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 |
15
- | `switch-api/api-switch.md` | `Switch` (`s`) — global data, webhooks, abort, server utilities | Using global data, webhooks, abort, or server settings |
16
- | `switch-api/api-flow-element.md` | `FlowElement` — properties, connections, job creation, logging | Reading properties, creating jobs, logging, connections |
17
- | `switch-api/api-job.md` | `Job` **signatures**: routing, file access, child jobs, private data, datasets | Looking up what a `job.*` method takes, returns, or throws |
18
- | `switch-api/api-connection.md` | `Connection` — type, properties, file count | Routing to specific connections or reading connection properties |
19
- | `switch-api/api-http.md` | `HttpRequest` / `HttpResponse` + webhook pattern | Handling incoming HTTP webhooks |
20
- | `switch-api/api-enums.md` | All enums with string values (`LogLevel`, `AccessLevel`, `DatasetModel`, `Scope`, `Priority`, `Connection.Level`, etc.) | Looking up enum values |
21
- | `switch-api/api-document-classes.md` | `PdfDocument`, `PdfPage`, `ImageDocument`, `XmlDocument`, `XmpDocument` — read-only file introspection | Inspecting PDF, image, XML, or XMP file contents |
22
- | `switch-api/api-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 |
23
- | `switch-api/api-tooling.md` | SwitchScriptTool commands and install paths, folder vs `.sscript` trade-offs, deployment | Running SwitchScriptTool: transpiling, packing, unpacking, or deploying |
24
- | `switch-api/api-debugging.md` | Enabling debug mode in Switch Designer, debuggable entry points, VS Code attach | Debugging a script |
25
- | `switch-api/api-vscode.md` | Type declarations, tsconfig for TypeScript 6, ESLint rules | Setting up VS Code or fixing type errors |
26
- | `switch-api/api-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 |
27
- | `switch-api/api-property-editors.md` | Property editor types, string return values, literal editors, dropdowns | Defining property editors in XML or reading property values in code |
28
- | `switch-api/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 `api-job.md` when you also need signatures |
29
- | `switch-api/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 |
30
- | `switch-api/api-logging.md` | Log level semantics, logging practice, `console.log` limitation, common gotchas | Adding or reviewing `job.log()`/`flowElement.log()`/`job.fail()`/`failProcess()` calls |
31
- | `switch-api/api-logs-and-dataroot.md` | Locating the Application Data Root, querying `ServerLogs.db3` directly | Diagnosing or validating a script from its actual log output rather than by reading the code |
32
- | `switch-api/api-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) | Preparing a script for publication as an app, or reviewing one against Appstore submission criteria |
15
+ | `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
+ | `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/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 |
21
+ | `switch-api/http.md` | `HttpRequest` / `HttpResponse` + webhook pattern | Handling incoming HTTP webhooks |
22
+ | `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 |
24
+ | `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
+ | `switch-project/tooling.md` | SwitchScriptTool commands and install paths, folder vs `.sscript` trade-offs, deployment | Running SwitchScriptTool: transpiling, packing, unpacking, or deploying |
26
+ | `switch-project/debugging.md` | Enabling debug mode in Switch Designer, debuggable entry points, VS Code attach | Debugging a script |
27
+ | `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 |
29
+ | `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
+ | `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
+ | `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 |
32
+ | `switch-api/logging.md` | Log level semantics, logging practice, `console.log` limitation, common gotchas | Adding or reviewing `job.log()`/`flowElement.log()`/`job.fail()`/`failProcess()` calls |
33
+ | `switch-project/logs-and-dataroot.md` | Locating the Application Data Root, querying `ServerLogs.db3` directly | Diagnosing or validating a script from its actual log output rather than by reading the code |
34
+ | `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) | Preparing a script for publication as an app, or reviewing one against Appstore submission criteria |
35
+ | `switch-project/property-documentation.md` | Writing guidance for `Tooltip` and `DetailedInfo` content on properties/connections | Writing or reviewing the text in a property's or connection's `Tooltip`/`DetailedInfo` |
36
+ | `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
+ | `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
+ | `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 |
33
39
 
34
40
  ## Key rules
41
+ - Before scaffolding a new script or app, work through `switch-project/project-planning.md` with the user.
35
42
  - 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.
36
46
  - Do not `export` entry point functions. Declare them with the literal `function` keyword at top
37
47
  level — arrow functions, `exports.name = ...`, and class methods are invisible to Switch.
38
48
  - Switch discovers entry points with a regex, not a parser. Never write a string literal whose
39
49
  content ends with a backslash, a regex literal, or division outside the plain `word / word`
40
50
  shape — each silently deletes a span of real code, and every entry point inside that span
41
- disappears with no error anywhere. Read `switch-api/api-entry-points.md` §
51
+ disappears with no error anywhere. Read `switch-api/entry-points.md` §
42
52
  Entry-point scanner constraints before editing `main.ts`/`main.js`.
43
53
  - Every `jobArrived` invocation must end with exactly one `job.sendTo*()` or `job.fail()` call — either in the same invocation or deferred to `timerFired` via job information stored in global data.
44
54
  - Use `AccessLevel.ReadOnly` for `job.get()` unless the file content will be modified.
45
55
  - Use VS Code snippets (`.vscode/switch.code-snippets`, prefix `switch…`) to scaffold entry points.
46
56
  - After calling `createJob()`, `createChild()`, or `createDataset()` with a file path, the script must delete the source file/folder after routing — Switch does not auto-remove it.
47
- - The XML declaration (`<ScriptID>.xml`) can be edited directly — read `switch-api/api-script-declaration.md` first and follow its rules exactly (no schema validates this format, so mistakes fail silently). Never change an existing script's `Name`. Bump `Version` on every declaration edit. Leave `manifest.xml` edits (package type, declaration filename, program files) to the user unless explicitly asked.
57
+ - The XML declaration (`<ScriptID>.xml`) can be edited directly — read `switch-project/script-declaration.md` first and follow its rules exactly (no schema validates this format, so mistakes fail silently). Never change an existing script's `Name`. Bump `Version` on every declaration edit. Leave `manifest.xml` edits (package type, declaration filename, program files) to the user unless explicitly asked.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enfocussw/switch-scripting-context",
3
- "version": "25.11.0-beta.13",
3
+ "version": "25.11.0-beta.15",
4
4
  "description": "AI coding assistant context for Enfocus Switch scripting (Node.js/TypeScript)",
5
5
  "keywords": [
6
6
  "switch",
@@ -27,14 +27,17 @@
27
27
  "docs/",
28
28
  "!docs/superpowers",
29
29
  "!docs/temp",
30
+ "!docs/adr",
30
31
  "CHANGELOG.md"
31
32
  ],
32
33
  "scripts": {
33
34
  "build": "tsc -p tsconfig.json",
34
35
  "build:test": "tsc src/init.test.ts --outDir dist --target ES2020 --module commonjs --lib ES2020 --types node --strict --esModuleInterop --skipLibCheck",
35
- "test": "npm run build && npm run build:test && node dist/init.test.js",
36
- "prepack": "npm run build",
37
- "postpack": "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);\""
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",
37
+ "prepack": "npm run build && node scripts/readme-links.js --publish",
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
+ "lint:prose": "node scripts/check-prose.js",
40
+ "lint:gotchas": "node scripts/check-gotcha-tags.js"
38
41
  },
39
42
  "author": "Sam Wallace",
40
43
  "license": "ISC",
File without changes
File without changes