@enfocussw/switch-scripting-context 25.11.1-beta.2 → 25.11.1-beta.3
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 +10 -0
- package/README.md +2 -2
- package/dist/init.d.ts +4 -0
- package/dist/init.js +31 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ All notable changes to this package are documented here. Format follows
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [25.11.1-beta.3] - 2026-09-17
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- `init` now records the version that produced the docs on the first line of
|
|
13
|
+
`switch-scripting.md`, as an HTML comment reading `switch-scripting-context <version>`. A tool
|
|
14
|
+
that installs the docs can read it to tell which version a project has, including a checkout
|
|
15
|
+
someone else set up. Re-running `init` rewrites the line, and `--dry-run` prints it without
|
|
16
|
+
writing.
|
|
17
|
+
|
|
8
18
|
## [25.11.1-beta.2] - 2026-09-17
|
|
9
19
|
|
|
10
20
|
### 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](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.
|
|
7
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.3/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.1-beta.
|
|
87
|
+
See [CHANGELOG.md](https://cdn.jsdelivr.net/npm/@enfocussw/switch-scripting-context@25.11.1-beta.3/CHANGELOG.md) for what changed.
|
|
88
88
|
|
|
89
89
|
## Options
|
|
90
90
|
|
package/dist/init.d.ts
CHANGED
|
@@ -31,4 +31,8 @@ export declare function generateZedRules(docsDir: string): string;
|
|
|
31
31
|
export declare function generateClineRules(docsDir: string): string;
|
|
32
32
|
export declare function buildIdMap(registry: ToolDefinition[]): Map<string, string>;
|
|
33
33
|
export declare function findMarkerRange(content: string): [number, number] | null;
|
|
34
|
+
/** The running package's own version, so a git-clone install stamps what actually ran. */
|
|
35
|
+
export declare function packageVersion(root?: string): string;
|
|
36
|
+
/** The comment init writes as the first line of the copied hub file. */
|
|
37
|
+
export declare function versionStamp(version: string): string;
|
|
34
38
|
export declare function run(argv?: string[]): Promise<void>;
|
package/dist/init.js
CHANGED
|
@@ -42,6 +42,8 @@ exports.generateZedRules = generateZedRules;
|
|
|
42
42
|
exports.generateClineRules = generateClineRules;
|
|
43
43
|
exports.buildIdMap = buildIdMap;
|
|
44
44
|
exports.findMarkerRange = findMarkerRange;
|
|
45
|
+
exports.packageVersion = packageVersion;
|
|
46
|
+
exports.versionStamp = versionStamp;
|
|
45
47
|
exports.run = run;
|
|
46
48
|
const fs = __importStar(require("fs"));
|
|
47
49
|
const path = __importStar(require("path"));
|
|
@@ -365,6 +367,34 @@ function copyDocs(packageRoot, destDir, dryRun) {
|
|
|
365
367
|
});
|
|
366
368
|
console.log(` docs → ${path.relative(process.cwd(), destDir)}/`);
|
|
367
369
|
}
|
|
370
|
+
// ─── Version stamp ───────────────────────────────────────────────────────────
|
|
371
|
+
/** The hub file in the copied docs folder that carries the version stamp. */
|
|
372
|
+
const HUB_FILE = 'switch-scripting.md';
|
|
373
|
+
/** The running package's own version, so a git-clone install stamps what actually ran. */
|
|
374
|
+
function packageVersion(root = packageRoot()) {
|
|
375
|
+
return JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8')).version;
|
|
376
|
+
}
|
|
377
|
+
/** The comment init writes as the first line of the copied hub file. */
|
|
378
|
+
function versionStamp(version) {
|
|
379
|
+
return `<!-- switch-scripting-context ${version} -->`;
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* Records which version produced the copied docs, so a consumer can tell what is installed
|
|
383
|
+
* without having recorded it at install time. Only the copy is stamped: the repo's own
|
|
384
|
+
* docs/switch-scripting.md is generated output and a stamp there would fight the generator.
|
|
385
|
+
* copyDocs wipes destDir on every run, so there is never a stale stamp to remove.
|
|
386
|
+
*/
|
|
387
|
+
function stampDocsVersion(packageRoot, destDir, dryRun) {
|
|
388
|
+
const stamp = versionStamp(packageVersion(packageRoot));
|
|
389
|
+
const hubPath = path.join(destDir, HUB_FILE);
|
|
390
|
+
const rel = path.relative(process.cwd(), hubPath);
|
|
391
|
+
if (dryRun) {
|
|
392
|
+
console.log(` [dry-run] ${rel} → first line ${stamp}`);
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
fs.writeFileSync(hubPath, `${stamp}\n${fs.readFileSync(hubPath, 'utf8')}`, 'utf8');
|
|
396
|
+
console.log(` ${rel} → stamped ${stamp}`);
|
|
397
|
+
}
|
|
368
398
|
// ─── .gitignore update ───────────────────────────────────────────────────────
|
|
369
399
|
function updateGitignore(targetRoot, docsDir, dryRun) {
|
|
370
400
|
const gitignorePath = path.join(targetRoot, '.gitignore');
|
|
@@ -511,6 +541,7 @@ function init(options) {
|
|
|
511
541
|
// 1. Copy docs
|
|
512
542
|
console.log('Copying docs...');
|
|
513
543
|
copyDocs(packageRoot, docsDestDir, options.dryRun);
|
|
544
|
+
stampDocsVersion(packageRoot, docsDestDir, options.dryRun);
|
|
514
545
|
// 2. Generate AI config files
|
|
515
546
|
const toolActions = [];
|
|
516
547
|
for (const toolDef of TOOL_REGISTRY) {
|