@enfocussw/switch-scripting-context 25.11.0-beta.9 → 25.11.1-beta.1
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 +256 -0
- package/README.md +59 -35
- package/dist/init.d.ts +15 -0
- package/dist/init.js +130 -76
- package/docs/switch-api/api-versions.md +116 -0
- package/docs/switch-api/connection.md +82 -0
- package/docs/switch-api/{api-document-classes.md → document-classes.md} +13 -2
- package/docs/switch-api/entry-points.md +171 -0
- package/docs/switch-api/{api-enums.md → enums.md} +23 -12
- package/docs/switch-api/{api-execution-environment.md → execution-environment.md} +39 -12
- package/docs/switch-api/{api-flow-element.md → flow-element.md} +23 -7
- package/docs/switch-api/{api-http.md → http.md} +10 -1
- package/docs/switch-api/job-patterns.md +178 -0
- package/docs/switch-api/{api-job.md → job.md} +23 -9
- package/docs/switch-api/{api-logging.md → logging.md} +47 -5
- package/docs/switch-api/{api-switch.md → switch.md} +68 -4
- package/docs/switch-appstore/app-guidelines.md +258 -0
- package/docs/switch-appstore/app-manual.md +84 -0
- package/docs/switch-appstore/app-store-listing.md +69 -0
- package/docs/switch-appstore/app-store-submission.md +83 -0
- package/docs/{switch-api/api-debugging.md → switch-project/debugging.md} +9 -0
- package/docs/{switch-api/api-logs-and-dataroot.md → switch-project/logs-and-dataroot.md} +10 -1
- package/docs/switch-project/project-planning.md +117 -0
- package/docs/switch-project/property-documentation.md +75 -0
- package/docs/{switch-api/api-property-editors.md → switch-project/property-editors.md} +55 -8
- package/docs/{switch-api/api-script-declaration.md → switch-project/script-declaration.md} +47 -13
- package/docs/switch-project/script-structure.md +188 -0
- package/docs/{switch-api/api-tooling.md → switch-project/tooling.md} +87 -1
- package/docs/{switch-api/api-vscode.md → switch-project/vscode.md} +19 -0
- package/docs/switch-scripting.md +49 -23
- package/package.json +11 -7
- package/docs/switch-api/api-connection.md +0 -63
- package/docs/switch-api/api-entry-points.md +0 -82
- package/docs/switch-api/api-job-patterns.md +0 -79
- package/docs/switch-api/api-script-structure.md +0 -85
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,262 @@ All notable changes to this package are documented here. Format follows
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [25.11.1-beta.1] - 2026-09-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `remove --tools <list>` removes the Switch section only from the named tools' AI config files.
|
|
13
|
+
The docs folder, the `.gitignore` entry and other tools' config stay in place. Without
|
|
14
|
+
`--tools`, or with every tool listed, `remove` still removes everything.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `remove` now deletes the Cursor rule file and the scoped GitHub Copilot instructions file,
|
|
19
|
+
plus their folders if nothing else is in them. Before, it left both files behind containing
|
|
20
|
+
only their frontmatter. A file whose frontmatter you edited or wrote yourself is kept, with only
|
|
21
|
+
the Switch section removed.
|
|
22
|
+
|
|
23
|
+
## [25.11.1-beta.0] - 2026-09-15
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
|
|
27
|
+
- New `api-versions.md` lists which Switch release added each scripting API class, method, and
|
|
28
|
+
enum value. The API docs now mark each method, class, and enum value that needs a newer release
|
|
29
|
+
than the baseline with its minimum Switch version. Agents can check calls against the oldest
|
|
30
|
+
Switch a script or app must support.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- The Node.js version table now covers Switch 25.07, 26.03, and 26.07. It also explains that
|
|
35
|
+
`--pack` and SwitchScripter overwrite `SwitchVersion`, so a packed script can run on a newer
|
|
36
|
+
Node.js than its folder. It covers fallbacks for unlisted values and notes that API methods
|
|
37
|
+
follow the running Switch, not the manifest.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- The routing table in `switch-scripting.md` now renders correctly in strict markdown parsers,
|
|
42
|
+
including VS Code's preview. The generated marker comments previously sat between the table's
|
|
43
|
+
header and its first row, which ended the table early per the GFM table spec; they now wrap the
|
|
44
|
+
whole table instead.
|
|
45
|
+
|
|
46
|
+
## [25.11.0-beta.18] - 2026-09-11
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- The script declaration doc no longer tells agents to bump `Version` on every declaration change.
|
|
51
|
+
It now says to bump once per release and keep an unreleased number while editing, matching the
|
|
52
|
+
Appstore guidelines. It also notes that SwitchScripter only accepts minor versions for apps.
|
|
53
|
+
|
|
54
|
+
## [25.11.0-beta.17] - 2026-09-11
|
|
55
|
+
|
|
56
|
+
### Changed
|
|
57
|
+
- `job.md`'s `sendToData()` entry and `connection.md`'s `getPropertyStringValue()` entry now warn
|
|
58
|
+
directly, at the point an agent is most likely to read them, that there is no way to check in
|
|
59
|
+
advance whether a connection accepts a given traffic light level. The warning previously lived
|
|
60
|
+
only in a separate section agents weren't always reaching first.
|
|
61
|
+
|
|
62
|
+
## [25.11.0-beta.16] - 2026-09-10
|
|
63
|
+
|
|
64
|
+
### Added
|
|
65
|
+
- Connection docs clarify that traffic light levels (`Connection.Level.Success`/`Warning`/`Error`)
|
|
66
|
+
only select where `sendToData()`/`sendToLog()` route a job; they cannot be read back from a
|
|
67
|
+
connection object, and `sendToData()` fails the job if no connected level matches. Scripts that
|
|
68
|
+
need optional traffic light routing should expose a custom property and fall back to
|
|
69
|
+
`sendToNull()`.
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
- `switch-scripting.md`'s own text told agents to grep a `docs/` prefix that only exists in this
|
|
73
|
+
repo's source tree, not in a consuming project's copied docs folder. Agents following that
|
|
74
|
+
instruction literally hit a folder that doesn't exist. The text now describes the copied layout.
|
|
75
|
+
|
|
76
|
+
## [25.11.0-beta.15] - 2026-09-10
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
- `property-documentation.md`, `app-store-listing.md`, `app-manual.md`, and
|
|
80
|
+
`app-store-submission.md`: writing guidance for the four separate places app documentation
|
|
81
|
+
ends up (per-property `Tooltip`/`DetailedInfo`, the declaration's listing fields, the uploaded
|
|
82
|
+
app manual document, and the Appstore website submission forms), including which content is
|
|
83
|
+
reused between them, icon specs, and a shared checklist against generic-sounding text.
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
- Docs reorganized under `docs/`: the scripting API stays in `docs/switch-api/`; project structure
|
|
87
|
+
and tooling docs moved to `docs/switch-project/`; Appstore publishing guidance moved to
|
|
88
|
+
`docs/switch-appstore/`. Update any bookmarked doc paths after upgrading.
|
|
89
|
+
- Dropped the `api-` prefix from doc filenames, for example `switch-api/job.md`, since each file's
|
|
90
|
+
folder already says what kind of doc it is.
|
|
91
|
+
- Each doc file now carries its own routing metadata (trigger and summary) as YAML frontmatter,
|
|
92
|
+
generated into the routing table and README's doc list instead of hand-duplicated in both.
|
|
93
|
+
README's descriptions now match the table's wording exactly; a few had drifted apart.
|
|
94
|
+
|
|
95
|
+
### Fixed
|
|
96
|
+
- `init` now removes the destination docs folder before copying, instead of only adding and
|
|
97
|
+
overwriting. Previously, a doc renamed or moved between versions left the old file behind
|
|
98
|
+
permanently after an upgrade, since the destination folder is gitignored and nothing surfaced
|
|
99
|
+
the stale copy.
|
|
100
|
+
|
|
101
|
+
## [25.11.0-beta.14] - 2026-09-09
|
|
102
|
+
|
|
103
|
+
### Added
|
|
104
|
+
- `switch-scripting.md` now tells agents to grep `docs/switch-api/` for `known issue`, `gotcha`,
|
|
105
|
+
`quirk`, `caveat` to find documented pitfalls before writing code in an area.
|
|
106
|
+
- `api-entry-points.md` documents that a flow restart replays every queued job through `jobArrived`
|
|
107
|
+
again, even one whose processing was deferred to `timerFired`. A script relying on that pattern
|
|
108
|
+
must recognize an already-registered job and return quickly, or a large backlog is slow to clear.
|
|
109
|
+
- `api-project-planning.md`, a pre-scaffolding checklist for new scripts and apps: Script vs App,
|
|
110
|
+
job-processing approach, target OS, Switch version baseline, concurrency, native/binary npm
|
|
111
|
+
dependency feasibility, and Appstore competition risk. Loaded before any files are scaffolded.
|
|
112
|
+
|
|
113
|
+
### Changed
|
|
114
|
+
- `README.md` no longer uses dashes as punctuation. Wording is unchanged otherwise.
|
|
115
|
+
- The published README now links to the changelog on jsdelivr, pinned to the version being
|
|
116
|
+
installed. Relative links were rewritten by npm to the private repo, so they were dead for
|
|
117
|
+
consumers. `prepack` swaps them in and `postpack` swaps them back.
|
|
118
|
+
|
|
119
|
+
## [25.11.0-beta.13] - 2026-09-09
|
|
120
|
+
|
|
121
|
+
### Fixed
|
|
122
|
+
- README's two CHANGELOG links pointed at an unversioned jsdelivr URL, which always serves the
|
|
123
|
+
*latest published* file. On GitHub that showed the published file rather than the repo's live one,
|
|
124
|
+
hiding unreleased entries. Both are now relative links, so GitHub resolves them to the live file.
|
|
125
|
+
- Generated tool config (Cursor, Codex/OpenCode, Windsurf, Zed, Cline) — the "Core rules" block told
|
|
126
|
+
agents never to edit `<ScriptID>.xml` and to send the user to SwitchScripter instead. That has
|
|
127
|
+
contradicted `api-script-declaration.md` and the `switch-scripting.md` key rules since the agent
|
|
128
|
+
editing policy was added, and it sat in an always-on rules file that outranks any doc the agent
|
|
129
|
+
loads later. Now matches the docs: direct editing is fine under the declaration's rules.
|
|
130
|
+
|
|
131
|
+
### Added
|
|
132
|
+
- `api-switch.md` — a "Translation extraction rules" section under `Switch.tr()`. Extraction is
|
|
133
|
+
static source analysis, so aliasing `Switch.tr`, concatenating with a variable, or interpolating
|
|
134
|
+
a template literal silently produces no translation entry at all. Documents what does work
|
|
135
|
+
(all quote styles, multi-line, literal-only concatenation, marking a string away from its use
|
|
136
|
+
site) and the `%1` + `messageParams` pattern for dynamic values.
|
|
137
|
+
- `api-job-patterns.md` — "Driving a third-party CLI application", the Node.js replacement for the
|
|
138
|
+
legacy `findApplicationPath`/`ApplicationPath` mechanism: a custom path property on the
|
|
139
|
+
`automatic;choosefile;sltextwithvar;scriptexp` chain, resolved once in `flowStartTriggered` into
|
|
140
|
+
`Scope.FlowElement` global data, with `failProcess()` when discovery fails and cleanup in
|
|
141
|
+
`flowStopTriggered`.
|
|
142
|
+
- `api-script-structure.md` — "Packing an app" and SwitchScripter/Switch version compatibility:
|
|
143
|
+
script folders can only be typed `Script` (pack, then retype to `App` in SwitchScripter), extra
|
|
144
|
+
files are unavailable in script-folder mode, the pack ID is always `com.enfocus.*` and is carried
|
|
145
|
+
over by opening the previous `.enfpack`, an app loads only in its build version or newer (no
|
|
146
|
+
Scripter for 25.07/25.11 — use 2024 Fall), and an unsigned app loads only on the machine that
|
|
147
|
+
built it.
|
|
148
|
+
- `api-app-guidelines.md` — the App-only section is now split into Identity and versioning,
|
|
149
|
+
Top-level declaration properties, Password protection, Localization, Icon, Extra files, Source
|
|
150
|
+
and review hygiene, and what review does and doesn't cover. New rules from the App SDK: script ID
|
|
151
|
+
charset and uniqueness, resubmit-without-bumping after a rejection, minor-version format, the
|
|
152
|
+
three-category limit and Product Management approval, unsigned apps always loading under
|
|
153
|
+
"Custom", `DetailedInfo` feeding the generated HTML docs, `ExecutionGroup` coordination for a
|
|
154
|
+
shared third-party application, `Compatibility`/`SupportInfo`/`AppDiscovery` being required to
|
|
155
|
+
build the pack at all, Node.js password protection being unrecoverable, the six-language limit on
|
|
156
|
+
app translations, the 200×200 Appstore icon, and macOS notarization checks via `codesign -dv`.
|
|
157
|
+
- Generated tool config and `switch-scripting.md` key rules — added the entry-point scanner
|
|
158
|
+
constraints (literal `function` keyword; no trailing-backslash string literals, regex literals, or
|
|
159
|
+
non-`word / word` division) to the always-on rules. Previously these lived only in
|
|
160
|
+
`api-entry-points.md`, so an agent making a small edit without opening that file had no signal
|
|
161
|
+
that the failure mode exists, and it fails silently.
|
|
162
|
+
|
|
163
|
+
### Changed
|
|
164
|
+
- Generated tool config for Cursor, Codex/OpenCode, Windsurf, Zed and Cline now lists each API doc
|
|
165
|
+
with its "Load when" routing text instead of a bare filename, so those agents can open the one
|
|
166
|
+
file they need without reading `switch-scripting.md` first. Costs ~600 tokens in the always-on
|
|
167
|
+
block, saves a ~1,300-token hub read per session.
|
|
168
|
+
- The routing table in `docs/switch-scripting.md` is now the single source for that list. `init.ts`
|
|
169
|
+
parses it (`parseRoutingTable()`); the two hardcoded 19-entry arrays are gone, as is the drift
|
|
170
|
+
they invited.
|
|
171
|
+
- `api-script-structure.md` — moved "App Store submission guidelines" into
|
|
172
|
+
`api-app-guidelines.md` § App-only and "Execution modes" into `api-execution-environment.md`,
|
|
173
|
+
leaving pointers at both old headings. Reviewing an app or reasoning about concurrency previously
|
|
174
|
+
needed two files for one topic. Existing anchor links still resolve.
|
|
175
|
+
- `docs/switch-scripting.md` and `README.md` — sharpened the routing descriptions for
|
|
176
|
+
`api-job.md` (signatures) vs `api-job-patterns.md` (rules and gotchas), and for
|
|
177
|
+
`api-script-structure.md` vs `api-tooling.md`. Their triggers overlapped enough that an agent had
|
|
178
|
+
to load both files for any job-handling task.
|
|
179
|
+
- `init` no longer copies `docs/superpowers`, `docs/temp`, or `.DS_Store` into a consuming project.
|
|
180
|
+
The published tarball already excludes them, but `init` run from a git clone did not.
|
|
181
|
+
|
|
182
|
+
## [25.11.0-beta.12] - 2026-09-08
|
|
183
|
+
|
|
184
|
+
### Fixed
|
|
185
|
+
- `README.md` — linked the two `CHANGELOG.md` mentions to the jsdelivr-served copy of the file
|
|
186
|
+
instead of leaving them as unlinked plain text. A relative link would have npm rewrite it to a
|
|
187
|
+
GitHub blob URL that 404s on npmjs.com, since the source repo is private; jsdelivr serves the file
|
|
188
|
+
straight from the published tarball regardless of repo visibility.
|
|
189
|
+
|
|
190
|
+
## [25.11.0-beta.11] - 2026-09-08
|
|
191
|
+
|
|
192
|
+
### Added
|
|
193
|
+
- `api-entry-points.md` — documented that Switch's entry-point scanner is regex-based (not a real
|
|
194
|
+
parser) and can silently drop `function` declarations from certain source shapes: string literals
|
|
195
|
+
ending in a backslash, regex literals (especially ones containing an unescaped `/` inside a
|
|
196
|
+
character class), and division not in a plain `word / word` shape. Applies to every entry point,
|
|
197
|
+
not just the ones checked at load time; `calculateScriptExpression` is the one exception, since
|
|
198
|
+
it's dispatched directly rather than through this scanner. Verified against real
|
|
199
|
+
`SwitchScriptTool --pack` output for each failure mode.
|
|
200
|
+
- `api-tooling.md` — new "Verify entry points before packing" section with a Python/Node.js script
|
|
201
|
+
to check a built `main.js` for the expected entry points before relying on `--pack`, which doesn't
|
|
202
|
+
validate this itself.
|
|
203
|
+
- `api-script-structure.md` — cross-linked the entry-point scanner constraints from the "Agent
|
|
204
|
+
editing policy" callout.
|
|
205
|
+
- `api-app-guidelines.md` — new pre-publish checklist for scripts submitted to the Enfocus Appstore,
|
|
206
|
+
covering property naming/tooltip/editor/default requirements, entry point and `sendTo*()`
|
|
207
|
+
consistency with declared connections, logging quality, temp file/path handling, and app-only
|
|
208
|
+
packaging rules (no embedded Oracle JRE, universal signed macOS Mach-O binaries in extra files,
|
|
209
|
+
immutable extra files, translation completeness). Registered in the routing table, both `init.ts`
|
|
210
|
+
doc-file arrays, and the README's included-docs list.
|
|
211
|
+
|
|
212
|
+
### Changed
|
|
213
|
+
- `switch-scripting.md` — broadened the `api-entry-points.md` routing-table trigger to any edit to
|
|
214
|
+
`main.ts`/`main.js`, not just adding a new entry point.
|
|
215
|
+
- `api-property-editors.md` — documented that the `nofiles`/`allfiles`/`allotherfiles` and
|
|
216
|
+
`nofolders`/`allfolders`/`allotherfolders` literal editors are specifically for connection
|
|
217
|
+
include/exclude filter mask properties, with the exact `Editor`/`Default`/`Subtype` chain verified
|
|
218
|
+
against Switch's own built-in connection filter declarations; added the matching rows to Common
|
|
219
|
+
practices. Noted that `next`/`current` have no confirmed script-facing use case. Noted that `none`
|
|
220
|
+
is the sanctioned way to allow an empty value under `Validation="Standard"`.
|
|
221
|
+
- `api-script-declaration.md` — cross-linked the `Validation` row to the `none` literal editor for
|
|
222
|
+
allowing empty values under `Standard` validation.
|
|
223
|
+
- `api-app-guidelines.md`, `api-script-declaration.md`, `api-property-editors.md`,
|
|
224
|
+
`api-entry-points.md`, `api-job-patterns.md`, `api-logging.md`, `api-script-structure.md` —
|
|
225
|
+
reclassified the Appstore submission rules added previously: most turned out to be universal
|
|
226
|
+
correctness rules (functional requirements or bugs if violated) rather than app-specific policy,
|
|
227
|
+
so their "App guideline" framing was removed and they're now stated as plain rules that apply to
|
|
228
|
+
every script. Only a handful remain "mandatory for apps, recommended for scripts" (property
|
|
229
|
+
naming/tooltip/default, non-module-editor requirement, log volume, platform-independent paths).
|
|
230
|
+
"No embedded Oracle JRE" moved out of the app-only section entirely, since it applies to any
|
|
231
|
+
script bundling extra files. `api-app-guidelines.md` is now organized into three explicit tiers
|
|
232
|
+
(Universal / Apps required-scripts recommended / Apps only) instead of one flat list.
|
|
233
|
+
- `api-script-declaration.md`, `api-property-editors.md`, `api-entry-points.md`, `api-job-patterns.md`,
|
|
234
|
+
`api-job.md`, `api-logging.md`, `api-script-structure.md` — wove the individual Appstore submission
|
|
235
|
+
rules (above) directly into the relevant existing sections (property attributes, editor tables,
|
|
236
|
+
entry point signatures, `sendTo*()`/`ConnectionType` rules, logging conventions, packaging), each
|
|
237
|
+
cross-linked to and from the new checklist, so they're followed from the start rather than caught
|
|
238
|
+
only at a pre-publish review.
|
|
239
|
+
- `api-script-declaration.md` — fixed the `Validation="Custom"` row, which named a nonexistent
|
|
240
|
+
`isPropertyValid` entry point; the actual entry point (per `api-entry-points.md`) is
|
|
241
|
+
`validateProperties`/`validateConnectionProperties`.
|
|
242
|
+
- `api-job-patterns.md` — clarified that the automatic executor-refresh cleanup only applies to
|
|
243
|
+
temp files created via `flowElement.createPathWithName()` (the recommended default); temp files
|
|
244
|
+
created any other way must be cleaned up explicitly by the script. Also notes that the `tmp` npm
|
|
245
|
+
package is not recommended, and if used anyway, its `setGracefulCleanup()` is not always reliable
|
|
246
|
+
in the Switch execution environment and `discardDescriptor: true` should be set.
|
|
247
|
+
- `api-flow-element.md`, `api-connection.md`, `api-script-declaration.md` — cross-linked and made
|
|
248
|
+
explicit that `getPropertyStringValue()`/`connection.getPropertyStringValue()` throws
|
|
249
|
+
`"Invalid tag: <tag>"` for a `Dependency` dependent property currently hidden by its master's
|
|
250
|
+
value, and that `hasProperty()`/`connection.hasProperty()` should be used to guard against this
|
|
251
|
+
(e.g. before fetching properties dependent on a drop-down/enum master). Also notes that the shown
|
|
252
|
+
set can vary per job if the master's value is dynamic, and that a hidden dependent's value cannot
|
|
253
|
+
be read at all — a script needing more than one dependency group's data at once must use a
|
|
254
|
+
different property structure, not `Dependency`-based hiding.
|
|
255
|
+
|
|
256
|
+
## [25.11.0-beta.10] - 2026-09-03
|
|
257
|
+
|
|
258
|
+
### Added
|
|
259
|
+
- `api-job-patterns.md` — documented a known ordering bug: creating a child job before writing a
|
|
260
|
+
pending dataset causes the child to inherit the stale dataset, leading to a destructive
|
|
261
|
+
file-move race at `sendTo*()`. `api-job.md`'s dataset/child-job entries now note which calls
|
|
262
|
+
are immediate vs. deferred.
|
|
263
|
+
|
|
8
264
|
## [25.11.0-beta.9] - 2026-08-26
|
|
9
265
|
|
|
10
266
|
### Added
|
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](CHANGELOG.md) for what's changed between versions.
|
|
7
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.1/CHANGELOG.md) (also included in this package) for what's changed between versions.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
10
10
|
|
|
@@ -34,13 +34,13 @@ The package version tracks the Switch release its docs describe:
|
|
|
34
34
|
└────── Switch version (25.11)
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
- `25.11.x
|
|
38
|
-
- The next Switch release moves the first two numbers (e.g. Switch
|
|
37
|
+
- `25.11.x`: every release of this package documenting **Switch 25.11**. Patch increments are doc updates, fixes, and new features of the CLI itself.
|
|
38
|
+
- The next Switch release moves the first two numbers (e.g. Switch 27.07 → `27.7.0`). Note that semver forbids leading zeros, so `27.07` is published as `27.7`.
|
|
39
39
|
- **Pin with `~`, not `^`.** `~25.11.0` stays on Switch 25.11; `^25.11.0` would happily install `25.12.0`, which targets a different Switch release.
|
|
40
40
|
|
|
41
41
|
### Prereleases
|
|
42
42
|
|
|
43
|
-
Beta builds append a prerelease suffix
|
|
43
|
+
Beta builds append a prerelease suffix, for example `25.11.0-beta.1`. These sort *below* `25.11.0`,
|
|
44
44
|
so the beta line precedes GA and leaves `25.11.0` free for the first published release.
|
|
45
45
|
|
|
46
46
|
## What it does
|
|
@@ -53,9 +53,9 @@ so the beta line precedes GA and leaves `25.11.0` free for the first published r
|
|
|
53
53
|
|
|
54
54
|
| Tool | File | How context is loaded |
|
|
55
55
|
|---|---|---|
|
|
56
|
-
| Claude Code / ClawCode | `CLAUDE.md` | `@switch-docs/switch-scripting.md` import
|
|
56
|
+
| Claude Code / ClawCode | `CLAUDE.md` | `@switch-docs/switch-scripting.md` import; hub file routes to specific API docs on demand |
|
|
57
57
|
| GitHub Copilot | `.github/copilot-instructions.md` | `#file:` reference to hub |
|
|
58
|
-
| GitHub Copilot (scoped) | `.github/instructions/switch-scripting.instructions.md` | `applyTo: "**/*.ts"
|
|
58
|
+
| GitHub Copilot (scoped) | `.github/instructions/switch-scripting.instructions.md` | `applyTo: "**/*.ts"`; auto-attaches to every TypeScript file edit |
|
|
59
59
|
| Cursor | `.cursor/rules/switch-scripting.mdc` | Inline key rules + full API file path list |
|
|
60
60
|
| Codex CLI / OpenCode | `AGENTS.md` | Inline key rules + full API file path list |
|
|
61
61
|
| Gemini CLI | `GEMINI.md` | `@switch-docs/switch-scripting.md` import |
|
|
@@ -63,28 +63,28 @@ so the beta line precedes GA and leaves `25.11.0` free for the first published r
|
|
|
63
63
|
| Zed | `.rules` | Inline key rules + full API file path list |
|
|
64
64
|
| Cline | `.clinerules` | Inline key rules + full API file path list |
|
|
65
65
|
|
|
66
|
-
All files use `<!-- switch-scripting-context begin -->` / `<!-- switch-scripting-context end -->` markers. Re-running `init` replaces only the Switch section in existing files
|
|
66
|
+
All files use `<!-- switch-scripting-context begin -->` / `<!-- switch-scripting-context end -->` markers. Re-running `init` replaces only the Switch section in existing files. Project-specific rules outside the markers are untouched.
|
|
67
67
|
|
|
68
68
|
## Using this with your coding agent
|
|
69
69
|
|
|
70
|
-
Once `init` has run, just work normally
|
|
70
|
+
Once `init` has run, just work normally. Describe what you want in plain terms and prompt as you
|
|
71
71
|
usually would. Your agent picks up the Switch context automatically (via `@import` for Claude
|
|
72
72
|
Code/Gemini, or the inlined rules + file list for the others) whenever it's working in the project,
|
|
73
73
|
and pulls in the specific API doc it needs for the task at hand on its own. You don't need to know
|
|
74
74
|
the doc file names or tell it which one to read.
|
|
75
75
|
|
|
76
76
|
A few things this gets you without asking for them by name:
|
|
77
|
-
- Scaffolding a new entry point, handling a webhook, or reading/creating datasets and jobs
|
|
77
|
+
- Scaffolding a new entry point, handling a webhook, or reading/creating datasets and jobs. The
|
|
78
78
|
agent consults the matching API reference before writing the code.
|
|
79
|
-
- Diagnosing why a script isn't behaving as expected
|
|
79
|
+
- Diagnosing why a script isn't behaving as expected. The agent knows it can locate and query
|
|
80
80
|
Switch's own log database (`ServerLogs.db3`) rather than only re-reasoning about the code.
|
|
81
|
-
- Creating, packing, or deploying a script
|
|
82
|
-
flags and
|
|
83
|
-
- Editing the script's XML declaration
|
|
84
|
-
properties (app path/
|
|
81
|
+
- Creating, packing, or deploying a script. The agent uses `SwitchScriptTool` with the documented
|
|
82
|
+
flags and behaviour, rather than hand-rolling the steps.
|
|
83
|
+
- Editing the script's XML declaration. The agent follows the documented rules and knows which
|
|
84
|
+
properties (app path/licence) are off-limits and left to SwitchScripter's GUI instead.
|
|
85
85
|
|
|
86
|
-
Re-run `init` after upgrading this package so the copied docs and generated config files catch up
|
|
87
|
-
|
|
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.1-beta.1/CHANGELOG.md) for what changed.
|
|
88
88
|
|
|
89
89
|
## Options
|
|
90
90
|
|
|
@@ -118,6 +118,21 @@ npx switch-scripting-context init --dry-run
|
|
|
118
118
|
npx switch-scripting-context init --docs-dir ai-context
|
|
119
119
|
```
|
|
120
120
|
|
|
121
|
+
To undo `init`, run `remove`. By default it deletes the docs folder, the Switch section in every AI config file, and the `.gitignore` entry. With `--tools`, it only removes those tools' config sections and leaves the docs folder and other tools in place. Listing every tool is the same as a plain `remove`:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
npx switch-scripting-context remove [options]
|
|
125
|
+
|
|
126
|
+
--tools <list> Only remove these tools' config. Default: remove everything
|
|
127
|
+
--docs-dir <dir> Docs folder to remove. Default: switch-docs
|
|
128
|
+
--dry-run Print what would happen without writing any files
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
# Stop configuring Cursor, keep everything else
|
|
133
|
+
npx switch-scripting-context remove --tools cursor
|
|
134
|
+
```
|
|
135
|
+
|
|
121
136
|
## TypeScript types
|
|
122
137
|
|
|
123
138
|
This package does not bundle `@types/switch-scripting`. Add the type declarations to your project manually:
|
|
@@ -130,22 +145,31 @@ npm install --save-dev "https://github.com/enfocus-switch/types-switch-scripting
|
|
|
130
145
|
|
|
131
146
|
The `switch-docs/` folder contains:
|
|
132
147
|
|
|
133
|
-
- `switch-scripting.md
|
|
134
|
-
|
|
135
|
-
- `switch-
|
|
136
|
-
- `switch-api/
|
|
137
|
-
- `switch-api/
|
|
138
|
-
- `switch-api/
|
|
139
|
-
- `switch-api/
|
|
140
|
-
- `switch-api/
|
|
141
|
-
- `switch-api/
|
|
142
|
-
- `switch-api/
|
|
143
|
-
- `switch-api/
|
|
144
|
-
- `switch-
|
|
145
|
-
- `switch-
|
|
146
|
-
- `switch-
|
|
147
|
-
- `switch-
|
|
148
|
-
- `switch-
|
|
149
|
-
- `switch-
|
|
150
|
-
- `switch-api/
|
|
151
|
-
- `switch-api/
|
|
148
|
+
- `switch-scripting.md`: master index with execution environment rules and "load when" routing table
|
|
149
|
+
<!-- docs-index:readme begin -->
|
|
150
|
+
- `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
|
|
151
|
+
- `switch-api/entry-points.md`: All entry point signatures, constraints, and when each is called
|
|
152
|
+
- `switch-api/switch.md`: `Switch` (`s`): global data, webhooks, abort, server utilities
|
|
153
|
+
- `switch-api/flow-element.md`: `FlowElement`: properties, connections, job creation, logging
|
|
154
|
+
- `switch-api/job.md`: `Job` **signatures**: routing, file access, child jobs, private data, datasets
|
|
155
|
+
- `switch-api/connection.md`: `Connection`: type, properties, file count
|
|
156
|
+
- `switch-api/http.md`: `HttpRequest` / `HttpResponse` + webhook pattern
|
|
157
|
+
- `switch-api/enums.md`: All enums with string values (`LogLevel`, `AccessLevel`, `DatasetModel`, `Scope`, `Priority`, `Connection.Level`, etc.)
|
|
158
|
+
- `switch-api/document-classes.md`: `PdfDocument`, `PdfPage`, `ImageDocument`, `XmlDocument`, `XmpDocument`: read-only file introspection
|
|
159
|
+
- `switch-project/script-structure.md`: What files a script folder contains, `manifest.xml` format, how `SwitchVersion` selects the Node.js version and which tools overwrite it, Script vs App
|
|
160
|
+
- `switch-project/tooling.md`: SwitchScriptTool commands and install paths, folder vs `.sscript` trade-offs, deployment
|
|
161
|
+
- `switch-project/debugging.md`: Enabling debug mode in Switch Designer, debuggable entry points, VS Code attach
|
|
162
|
+
- `switch-project/vscode.md`: Type declarations, tsconfig for TypeScript 6, ESLint rules
|
|
163
|
+
- `switch-project/script-declaration.md`: XML declaration reference: properties, connections, execution config; agents may edit this file directly
|
|
164
|
+
- `switch-project/property-editors.md`: Property editor types, string return values, literal editors, dropdowns
|
|
165
|
+
- `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
|
|
166
|
+
- `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
|
|
167
|
+
- `switch-api/logging.md`: Log level semantics, logging practice, `console.log` limitation, common gotchas
|
|
168
|
+
- `switch-project/logs-and-dataroot.md`: Locating the Application Data Root, querying `ServerLogs.db3` directly
|
|
169
|
+
- `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)
|
|
170
|
+
- `switch-project/property-documentation.md`: Writing guidance for `Tooltip` and `DetailedInfo` content on properties/connections
|
|
171
|
+
- `switch-appstore/app-store-listing.md`: Writing guidance for the declaration's Appstore listing fields: `Description`, `Compatibility`, `SupportInfo`, `AppDiscovery`, `Connections`
|
|
172
|
+
- `switch-appstore/app-manual.md`: Writing guidance for the separate app manual document uploaded during Appstore review (`documentation-app_name.docx` template)
|
|
173
|
+
- `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
|
|
174
|
+
- `switch-api/api-versions.md`: Which Switch release added each scripting API class, method, and enum value; API availability follows the running Switch, not `manifest.xml`
|
|
175
|
+
<!-- docs-index:readme end -->
|
package/dist/init.d.ts
CHANGED
|
@@ -9,6 +9,21 @@ export interface ToolDefinition {
|
|
|
9
9
|
altIds?: string[];
|
|
10
10
|
files: ToolFile[];
|
|
11
11
|
}
|
|
12
|
+
export interface ApiDoc {
|
|
13
|
+
/** Path within docs/, e.g. "switch-api/job.md". */
|
|
14
|
+
file: string;
|
|
15
|
+
/** The routing table's "Load when" text, verbatim. */
|
|
16
|
+
loadWhen: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The routing table in docs/switch-scripting.md is the single source of truth for
|
|
20
|
+
* which API docs exist and when to load each one. Everything the CLI generates is
|
|
21
|
+
* derived from it, so a new doc file needs registering in exactly one place here
|
|
22
|
+
* (plus README.md, which init.test.ts checks).
|
|
23
|
+
*/
|
|
24
|
+
export declare function parseRoutingTable(root?: string): ApiDoc[];
|
|
25
|
+
/** Filenames only, in routing-table order. */
|
|
26
|
+
export declare function apiFiles(root?: string): string[];
|
|
12
27
|
export declare function generateAgentsMd(docsDir: string): string;
|
|
13
28
|
export declare function generateGeminiMd(docsDir: string): string;
|
|
14
29
|
export declare function generateWindsurfRules(docsDir: string): string;
|