@goldenpigeon/dsh-eu4-indexer 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.2 — 2026-11-11
6
+
7
+ - Use the upstream CLI's `~/.eu4indexer` directory by default, sharing its index
8
+ registry and databases. Preserve explicit `home` settings; data in the previous
9
+ default directory is not moved automatically.
10
+ - Document installation through DSH Desktop's plugin page using the full scoped
11
+ npm package name.
12
+ - Separate main-branch checks, PR compatibility validation and tag-triggered
13
+ releases. Automatically stage npm updates and publish GitHub release assets
14
+ from the same verified set; remove the temporary release-specific retry workflow.
15
+ - Reuse public engine versions for plugin-only updates. Check real npm
16
+ authentication locally without replacing the production npm configuration.
17
+
5
18
  ## 0.1.1 — 2026-11-10
6
19
 
7
20
  - Compare canonical packaged entry-point paths during npm/pnpm verification,
package/README.md CHANGED
@@ -48,6 +48,21 @@ Requires **DSH v0.2.2-rc.1** (declared range `>=0.2.2-rc.1 <0.3.0`) and
48
48
  Node.js 24+. The engine bundles the .NET runtime; Linux also needs the
49
49
  [platform's native libraries](docs/packaging.md#linux-native-dependencies).
50
50
 
51
+ ### From the DSH Desktop plugin page
52
+
53
+ Open **Plugins → Add plugin** in DSH Desktop and enter the full npm package name:
54
+
55
+ ```text
56
+ @goldenpigeon/dsh-eu4-indexer
57
+ ```
58
+
59
+ Install the package, then restart DSH if prompted. Open the plugin's
60
+ **Game script indexes** configuration page to select game sources and build an
61
+ index. The matching engine and bundled EU4/HOI4 rules are installed with the
62
+ plugin.
63
+
64
+ ### From the CLI
65
+
51
66
  Install the [published npm package](https://www.npmjs.com/package/@goldenpigeon/dsh-eu4-indexer)
52
67
  into your DSH profile:
53
68
 
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ export const inject = ['agents', 'tools', 'skills'];
12
12
  export const Config = z.object({
13
13
  home: z
14
14
  .string()
15
- .default(path.join(os.homedir(), '.dsh', 'data', 'eu4-indexer'))
15
+ .default(path.join(os.homedir(), '.eu4indexer'))
16
16
  .description('Directory for registry, indexes, tasks and session defaults. The packaged engine and game rules are installed and updated with the plugin.'),
17
17
  executablePath: z
18
18
  .string()
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAShE,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAA;AACrC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;SAC/D,WAAW,CACV,4IAA4I,CAC7I;IACH,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,OAAO,CAAC,EAAE,CAAC;SACX,WAAW,CACV,sEAAsE,CACvE;IACH,QAAQ,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,MAAM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AK,CACrB,CACF,CAAA;IACL,GAAG,CAAC,EAAE,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1C,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,SAAS,CAAA;IAClB,CAAC,CAAC,CAAA;IACF,GAAG,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;IACrE,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7D,CAAC","sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-connection'\nimport type {} from '@deepseek-ai/dsh-tools'\nimport type { ServiceOptions } from './service.js'\nimport os from 'node:os'\nimport path from 'node:path'\nimport z from '@deepseek-ai/schemastery'\nimport * as McpClient from '@deepseek-ai/dsh-mcp-client'\nimport { IndexerService } from './service.js'\nimport { SessionConnections } from './integration/sessions.js'\nimport { registerSkills } from './integration/skills.js'\nimport { failure } from './util.js'\nimport { registerManagementTools } from './integration/tools.js'\nexport type {\n Api,\n ManagementRequest,\n ManagementResponses,\n ServiceState,\n Task,\n} from './contracts.js'\n\nexport const name = 'dsh-eu4-indexer'\nexport const inject = ['agents', 'tools', 'skills']\nexport const Config = z.object({\n home: z\n .string()\n .default(path.join(os.homedir(), '.dsh', 'data', 'eu4-indexer'))\n .description(\n 'Directory for registry, indexes, tasks and session defaults. The packaged engine and game rules are installed and updated with the plugin.',\n ),\n executablePath: z\n .string()\n .default('')\n .description(\n 'Optional external eu4indexer executable supporting management API 1.',\n ),\n language: z\n .union(['auto', 'zh', 'en'])\n .default('auto')\n .description(\n 'Deprecated compatibility field; the model selects the skill translation from the conversation, regardless of this value.',\n ),\n concurrency: z.number().min(1).max(8).default(2),\n timeoutMs: z.number().min(1000).max(300000).default(30000),\n toolCallTimeoutMs: z.number().min(1000).max(600000).default(60000),\n})\nexport type Config = Omit<ServiceOptions, 'engine'> & {\n language?: 'auto' | 'zh' | 'en'\n}\nexport async function apply(ctx: Context, config: Config) {\n const service = new IndexerService({\n ...config,\n home: path.resolve(config.home),\n })\n await service.init()\n const sessions = new SessionConnections(ctx, service, McpClient)\n service.onEngineChanging = (signal) => sessions.suspend(signal)\n service.onEngineChanged = () => sessions.resume()\n service.onRegistered = (name) => sessions.refresh(name)\n service.tasks.onCompleted = (task) =>\n ['index', 'refresh'].includes(task.kind)\n ? sessions.refresh(task.input.name)\n : undefined\n ctx.effect(() => async () => {\n await Promise.all([service.stop(), sessions.stop()])\n })\n await registerSkills(ctx)\n ctx.inject(['connection'], (ctx) => {\n // /api's sole RPC interceptor belongs to DSH's Gateway. Exact Fetch\n // routes coexist with it and Connection admits only owner Peers here.\n ctx.connection.fetch.register({\n path: '/api/eu4-indexer/dispatch',\n methods: ['POST'],\n requestBody: 'buffered',\n async fetch(request) {\n if (\n request.headers\n .get('content-type')\n ?.split(';', 1)[0]\n .trim()\n .toLowerCase() !== 'application/json'\n )\n return new Response('content type must be application/json', {\n status: 415,\n })\n let message\n try {\n message = await request.json()\n } catch {\n return new Response('body is not JSON', { status: 400 })\n }\n if (\n message?.type !== 'client-request' ||\n typeof message.rpcId !== 'string' ||\n message.method !== 'eu4-indexer/dispatch'\n )\n return new Response('invalid client-request envelope', {\n status: 400,\n })\n let result\n try {\n result = {\n ok: true,\n value: await service.dispatch(message.payload, {\n signal: request.signal,\n }),\n }\n } catch (error) {\n const detail = failure(error)\n result = {\n ok: false,\n error: {\n code: 'gateway/bad-request',\n message: detail.error,\n details: { code: detail.code },\n },\n }\n }\n return Response.json({\n type: 'server-response',\n rpcId: message.rpcId,\n result,\n })\n },\n })\n })\n registerManagementTools(ctx, service, sessions)\n const connect = (agent: ReturnType<Context['agents']['list']>[number]) =>\n sessions\n .rebind(String(agent.id))\n .catch((error) =>\n ctx.logger.warn(\n 'EU4 Indexer connection failed: %s',\n failure(error).error,\n ),\n )\n ctx.on('agent/created', async ({ agent }) => {\n await connect(agent)\n return undefined\n })\n ctx.on('agent/disposed', ({ agent }) => sessions.disposeAgent(agent))\n for (const agent of ctx.agents.list()) await connect(agent)\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,SAAS,CAAA;AACxB,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,CAAC,MAAM,0BAA0B,CAAA;AACxC,OAAO,KAAK,SAAS,MAAM,6BAA6B,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAShE,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAA;AACrC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAA;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,aAAa,CAAC,CAAC;SAC/C,WAAW,CACV,4IAA4I,CAC7I;IACH,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,OAAO,CAAC,EAAE,CAAC;SACX,WAAW,CACV,sEAAsE,CACvE;IACH,QAAQ,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;S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AAE,CAAC,eAAe,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;QAC1C,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;QACpB,OAAO,SAAS,CAAA;IAClB,CAAC,CAAC,CAAA;IACF,GAAG,CAAC,EAAE,CAAC,gBAAgB,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;IACrE,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE;QAAE,MAAM,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7D,CAAC","sourcesContent":["import type { Context } from '@deepseek-ai/cordis'\nimport type {} from '@deepseek-ai/dsh-client-connection'\nimport type {} from '@deepseek-ai/dsh-tools'\nimport type { ServiceOptions } from './service.js'\nimport os from 'node:os'\nimport path from 'node:path'\nimport z from '@deepseek-ai/schemastery'\nimport * as McpClient from '@deepseek-ai/dsh-mcp-client'\nimport { IndexerService } from './service.js'\nimport { SessionConnections } from './integration/sessions.js'\nimport { registerSkills } from './integration/skills.js'\nimport { failure } from './util.js'\nimport { registerManagementTools } from './integration/tools.js'\nexport type {\n Api,\n ManagementRequest,\n ManagementResponses,\n ServiceState,\n Task,\n} from './contracts.js'\n\nexport const name = 'dsh-eu4-indexer'\nexport const inject = ['agents', 'tools', 'skills']\nexport const Config = z.object({\n home: z\n .string()\n .default(path.join(os.homedir(), '.eu4indexer'))\n .description(\n 'Directory for registry, indexes, tasks and session defaults. The packaged engine and game rules are installed and updated with the plugin.',\n ),\n executablePath: z\n .string()\n .default('')\n .description(\n 'Optional external eu4indexer executable supporting management API 1.',\n ),\n language: z\n .union(['auto', 'zh', 'en'])\n .default('auto')\n .description(\n 'Deprecated compatibility field; the model selects the skill translation from the conversation, regardless of this value.',\n ),\n concurrency: z.number().min(1).max(8).default(2),\n timeoutMs: z.number().min(1000).max(300000).default(30000),\n toolCallTimeoutMs: z.number().min(1000).max(600000).default(60000),\n})\nexport type Config = Omit<ServiceOptions, 'engine'> & {\n language?: 'auto' | 'zh' | 'en'\n}\nexport async function apply(ctx: Context, config: Config) {\n const service = new IndexerService({\n ...config,\n home: path.resolve(config.home),\n })\n await service.init()\n const sessions = new SessionConnections(ctx, service, McpClient)\n service.onEngineChanging = (signal) => sessions.suspend(signal)\n service.onEngineChanged = () => sessions.resume()\n service.onRegistered = (name) => sessions.refresh(name)\n service.tasks.onCompleted = (task) =>\n ['index', 'refresh'].includes(task.kind)\n ? sessions.refresh(task.input.name)\n : undefined\n ctx.effect(() => async () => {\n await Promise.all([service.stop(), sessions.stop()])\n })\n await registerSkills(ctx)\n ctx.inject(['connection'], (ctx) => {\n // /api's sole RPC interceptor belongs to DSH's Gateway. Exact Fetch\n // routes coexist with it and Connection admits only owner Peers here.\n ctx.connection.fetch.register({\n path: '/api/eu4-indexer/dispatch',\n methods: ['POST'],\n requestBody: 'buffered',\n async fetch(request) {\n if (\n request.headers\n .get('content-type')\n ?.split(';', 1)[0]\n .trim()\n .toLowerCase() !== 'application/json'\n )\n return new Response('content type must be application/json', {\n status: 415,\n })\n let message\n try {\n message = await request.json()\n } catch {\n return new Response('body is not JSON', { status: 400 })\n }\n if (\n message?.type !== 'client-request' ||\n typeof message.rpcId !== 'string' ||\n message.method !== 'eu4-indexer/dispatch'\n )\n return new Response('invalid client-request envelope', {\n status: 400,\n })\n let result\n try {\n result = {\n ok: true,\n value: await service.dispatch(message.payload, {\n signal: request.signal,\n }),\n }\n } catch (error) {\n const detail = failure(error)\n result = {\n ok: false,\n error: {\n code: 'gateway/bad-request',\n message: detail.error,\n details: { code: detail.code },\n },\n }\n }\n return Response.json({\n type: 'server-response',\n rpcId: message.rpcId,\n result,\n })\n },\n })\n })\n registerManagementTools(ctx, service, sessions)\n const connect = (agent: ReturnType<Context['agents']['list']>[number]) =>\n sessions\n .rebind(String(agent.id))\n .catch((error) =>\n ctx.logger.warn(\n 'EU4 Indexer connection failed: %s',\n failure(error).error,\n ),\n )\n ctx.on('agent/created', async ({ agent }) => {\n await connect(agent)\n return undefined\n })\n ctx.on('agent/disposed', ({ agent }) => sessions.disposeAgent(agent))\n for (const agent of ctx.agents.list()) await connect(agent)\n}\n"]}
@@ -5,8 +5,8 @@
5
5
  The maintainer must personally perform the first publication of all nine packages:
6
6
  the main package and eight platform packages. Subsequent versions can only be
7
7
  staged by CI, then approved personally by the maintainer with npm 2FA. CI does not
8
- directly publish, approve or reject packages, or create remote tags or GitHub
9
- Releases.
8
+ directly publish, approve or reject npm packages. A version tag triggers staging
9
+ and a GitHub Release automatically; the maintainer still approves npm publication.
10
10
 
11
11
  All packages use the `@goldenpigeon` scope: `@goldenpigeon/dsh-eu4-indexer` and
12
12
  `@goldenpigeon/dsh-eu4-indexer-engine-<platform-suffix>`. Before initial publication,
@@ -53,11 +53,14 @@ only after every package has been published initially.
53
53
  ## Staging credentials
54
54
 
55
55
  In GitHub repository settings, create an **`npm-staging` environment**. Set
56
- **Deployment branches and tags** to **Selected branches and tags**, with a Branch
57
- rule for the default branch only (for example, `main`) and no Tag rules. Save
56
+ **Deployment branches and tags** to **Selected branches and tags**, with a Tag
57
+ rule for `v*` and no Branch rules. Save
58
58
  **`NPM_STAGE_TOKEN`** as an environment secret. GitHub checks branch restrictions
59
- before the job receives credentials; the workflow's default-branch check is an
60
- additional guard. See [GitHub environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments).
59
+ before the job receives credentials. The release workflow also requires the tag
60
+ to match `package.json` and point to a commit on the default branch.
61
+ When migrating from the old manual flow, replace its `main` Branch rule with the
62
+ `v*` Tag rule before the next release; changing workflow files does not update
63
+ the remote environment. See [GitHub environments](https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments).
61
64
 
62
65
  Do not store the token as a repository or organization secret, where workflows on
63
66
  other branches could reference it. If such a secret already exists, migrate it
@@ -108,14 +111,27 @@ tarball cannot override proxy, TLS or other npm settings through `publishConfig`
108
111
 
109
112
  ## Subsequent versions: CI stages, maintainer approves
110
113
 
114
+ CI follows the same event separation as
115
+ [dsh-remote](https://github.com/Golden-Pigeon/dsh-remote/tree/main/.github/workflows):
116
+
117
+ | Event | Action |
118
+ | -------------- | ----------------------------------------------------------------------------------- |
119
+ | Push to `main` | Build, typecheck and unit checks |
120
+ | Pull request | Full native compatibility, npm installation and release-set validation |
121
+ | Push `v*` tag | Validate tag, build and validate packages, stage npm updates, create GitHub Release |
122
+
123
+ The PR and release workflows share `package-tests.yml`. It has only a
124
+ `workflow_call` trigger and no npm credentials. Ordinary branches, PRs and manual
125
+ dispatches cannot stage packages.
126
+
111
127
  1. Update the main version and pin the upstream engine release, then run
112
128
  `npm run prepare:engines` to synchronize platform packages and exact dependencies.
113
129
  Platform versions follow upstream, independently of the main version. Update
114
130
  locks and the changelog, and test locally.
115
- 2. With authorization for the push, land changes on the default branch. In GitHub
116
- Actions, choose **Run workflow** on `package-tests`, select the default branch,
117
- set **stage** to `true` and choose `latest`, `next` or `beta`. `latest` rejects
118
- prereleases. Staging is disabled by default and blocked on other branches.
131
+ 2. Land reviewed changes on the default branch. With authorization, create and
132
+ push a tag matching the main version, such as `v0.1.2`. This automatically
133
+ starts `release.yml`; no separate manual staging dispatch is needed. Stable
134
+ versions use `latest`, and prereleases use `next`.
119
135
  3. Credential-free jobs build and test all platforms, musl containers and original
120
136
  rc.1 installed packages. Aggregation records the source commit and all nine
121
137
  candidate names, exact versions, filenames and SHA-512 hashes before full
@@ -126,40 +142,37 @@ tarball cannot override proxy, TLS or other npm settings through `publishConfig`
126
142
  versions, hashes and full manifests. It invokes
127
143
  `npm stage publish <tarball> --ignore-scripts` for platform packages before the
128
144
  main package, using the official registry and no artifact lifecycle scripts.
129
- 4. CI preflights all nine packages: initial publication must be complete, target
130
- versions must be neither public nor staged, and local artifacts must exist and
131
- remain unchanged. Each successful stage immediately adds the name, version,
145
+ 4. CI preflights all nine packages: initial publication must be complete, and local
146
+ artifacts must exist and remain unchanged. Already public versions are reused,
147
+ allowing a plugin update to keep the same upstream engine version.
148
+ It uses only `npm stage publish`, without requiring permission to list stages.
149
+ npm's shared version index rejects already staged or published versions; any
150
+ failure stops the job without retrying. Each successful stage adds the name, version,
132
151
  tag, stage ID and SHA-512 to the Actions summary. npm's returned name, version
133
152
  and integrity must match the uploaded tarball.
134
- 5. The summary stays **IN PROGRESS** until all nine stages succeed and local cleanup
135
- finishes, then becomes **COMPLETE**. Wait for the entire staging job to succeed.
153
+ 5. The summary stays **IN PROGRESS** until every package is staged or already
154
+ public and local cleanup finishes, then becomes **COMPLETE**. Wait for the
155
+ entire staging job to succeed.
136
156
  In npmjs.com's **Staged Packages**, inspect each stage and download tarballs if
137
- needed. Personally approve the eight platform packages with 2FA, confirm they
157
+ needed. Personally approve pending platform packages with 2FA, confirm they
138
158
  are installable, then approve the main package. In your own terminal you can
139
159
  also use `npm stage view <stage-id>`, `npm stage download <stage-id>` and
140
160
  `npm stage approve <stage-id>`. Approval commands never run in CI.
141
161
 
142
- Triggering GitHub Actions and approving publication on npm are separate actions.
143
- **Run workflow** requests staging only; the workflow has no direct-publication
144
- step bypassing maintainer approval.
162
+ Pushing a release tag requests automatic staging and GitHub publication. It does
163
+ not approve publication on npm; the workflow has no direct-publication step.
145
164
 
146
165
  ## GitHub Releases
147
166
 
148
- Create a GitHub Release for each plugin release as well as staging its npm set.
149
- With authorization, tag the exact default-branch commit that passed the release
150
- workflow, using the main plugin version, such as `v0.1.1`. The eight platform
151
- packages may use a different upstream-aligned version, such as `0.4.0`.
167
+ After successful staging, the separate `github-release` job publishes the tagged
168
+ release automatically. It downloads the same verified artifact by ID, verifies
169
+ its source commit and package hashes again, and attaches all nine original
170
+ tarballs and `release-set.json` without rebuilding. Notes come from the matching
171
+ version in `CHANGELOG.md`; `Unreleased` and older entries are excluded.
152
172
 
153
- Download the successful run's `verified-npm-release` artifact and verify its source
154
- commit, complete nine-package set and recorded hashes. Attach those same nine
155
- tarballs and `release-set.json` to the GitHub Release; do not rebuild or repack
156
- them. Include the changes, the upstream version and the npm status in the release
157
- notes. A GitHub Release can be available while npm packages still await the
158
- maintainer's personal approval. Approve all engine packages before the main npm
159
- package, as described above.
160
-
161
- GitHub tagging and release creation remain separate authorized operations; the
162
- credential-isolated npm staging job does not gain GitHub write permissions.
173
+ Only this job receives GitHub `contents: write`; it has no npm token. The staging
174
+ job retains `contents: read`. A GitHub Release can be available while npm stages
175
+ await personal approval. Existing release assets are not overwritten on rerun.
163
176
 
164
177
  ## Failure recovery
165
178
 
@@ -173,13 +186,20 @@ Staging downloads by validation's unique artifact ID, never by selecting a name
173
186
  again. If a later rerun deleted that ID, download fails rather than silently
174
187
  substituting another artifact.
175
188
 
176
- Inspect the nine packages' staged state first. An existing stage for the same
177
- version blocks any new uploads on rerun. The maintainer can personally reject the
178
- existing stages, then rerun the complete release set. Do not approve a partial
179
- set before the whole staging job succeeds. Already public versions cannot be
180
- replaced; prepare and test a new common version. Tags cannot be changed after
181
- staging; reject the old stage before restaging with another tag.
189
+ Inspect the summary and npm staged state first. An existing pending version is
190
+ rejected by the registry, stopping the job at that package. The maintainer can
191
+ personally reject a partial set before retrying; CI never rejects or approves it.
192
+ Already public versions are skipped. Do not approve a partial set. Published
193
+ content cannot be replaced: change the plugin version or publish a new upstream
194
+ engine version as appropriate. Distribution tags cannot be changed after staging;
195
+ reject the old stage before restaging with another distribution tag.
196
+
197
+ Fix configuration before retrying a failed job on the original tag. Rerunning
198
+ only the failed staging job reuses its verified artifact; it does not require a
199
+ temporary workflow, hardcoded run IDs, replaced source metadata or repeated builds.
182
200
 
183
201
  Local regressions use a temporary loopback registry and fake credentials. They
184
- check that the real npm CLI writes only to staging endpoints, uploads identical
185
- bytes and does not run lifecycle scripts. They never write to real npm endpoints.
202
+ check real npm with the production npmrc and fake tokens: authentication headers,
203
+ registry `401` handling, staging-only endpoints, identical bytes and disabled
204
+ lifecycle scripts. They never write to real npm endpoints. Run `actionlint` locally
205
+ before submitting workflow changes.
package/docs/usage.md CHANGED
@@ -101,13 +101,17 @@ when editing a profile.
101
101
 
102
102
  | Field | Default | Meaning |
103
103
  | ------------------- | ------------------------- | ------------------------------------------------------------------------------------------- |
104
- | `home` | `~/.dsh/data/eu4-indexer` | Registry, indexes, tasks and chat defaults |
104
+ | `home` | `~/.eu4indexer` | Registry, indexes, tasks and chat defaults |
105
105
  | `executablePath` | Empty | External engine supporting management API 1; takes precedence over the path saved in the UI |
106
106
  | `language` | `auto` | Legacy compatibility; `zh` / `en` remain accepted but do not fix the skill language |
107
107
  | `concurrency` | `2` | Parallel background tasks, from 1 to 8; changes to the same index are exclusive |
108
108
  | `timeoutMs` | `30000` | Short management-request timeout in milliseconds; not used for background builds |
109
109
  | `toolCallTimeoutMs` | `60000` | MCP query timeout in milliseconds |
110
110
 
111
+ The default `home` is shared with the upstream CLI, so both use the same index
112
+ registry and databases. Explicit `home` settings keep their configured paths;
113
+ existing data in `~/.dsh/data/eu4-indexer` is not moved automatically.
114
+
111
115
  Use a separate `home` for each independent DSH host. `DSH_HOME` alone does not
112
116
  override the plugin data path. Isolated tests also need a separate skill directory
113
117
  and plugin `home`; see [isolated Web validation](../CONTRIBUTING.md#isolated-web-validation).
@@ -326,7 +326,29 @@ Earlier TS source reviews, behavior comparisons and Web screenshots are in
326
326
  `artifacts/ts-final-review/`, `artifacts/ts-review/` and `artifacts/ts-review2/`.
327
327
  See the [history](reviews/2026-11-08.md) for chronology.
328
328
 
329
- ## npm staging validation
329
+ ## Tag-driven CI review
330
+
331
+ The local replacement separates main pushes, PR compatibility checks and release
332
+ tag pushes. `actionlint` validates all entry points and the reusable package build.
333
+ The temporary workflow with fixed 0.1.1 commit, run and artifact IDs is removed.
334
+ Tag guards, first-publication protection, reused public engine versions, partial
335
+ receipts and credential isolation are exercised locally. Real npm 11.21.2 uses
336
+ the unchanged production npmrc while test transport routes requests to loopback;
337
+ tests verify its authorization header and a registry `401` response.
338
+
339
+ Read-only inspection found the remote `npm-staging` environment still allows only
340
+ the `main` branch. It must be migrated to a `v*` Tag rule before the tag workflow
341
+ can receive its secret. The local workflow change does not make that remote edit.
342
+ Earlier live stage attempts returned `E401`, including `stage publish` itself;
343
+ removing `stage list` did not resolve authentication. A direct read-only request
344
+ with the old local token also returned `401`. The maintainer subsequently
345
+ confirmed the old token was faulty and replaced it; the existing GitHub
346
+ environment secret was updated from that file without another live probe or
347
+ staging attempt. Local tests establish that the runner constructs the
348
+ authentication header. No Actions run is used as a substitute for local
349
+ validation of this change.
350
+
351
+ ## Earlier npm staging validation
330
352
 
331
353
  The workflow and scripts passed local actionlint, compilation, type, unit and
332
354
  browser checks. Regressions cover whole-set initial-publication guards,
@@ -337,19 +359,19 @@ Actual npm packlists exclude `.secret/` and token files; tests do not read token
337
359
  Credential review removed project dependency installation and builds from the
338
360
  staging job. Release receipts bind the workflow commit, nine archive hashes and
339
361
  exact dependencies. Full-script regressions run without `node_modules` or `dist`.
340
- They cover explicit staging opt-in, zero uploads when the last package lacks an
362
+ They covered the old explicit staging opt-in, zero uploads when the last package lacks an
341
363
  initial publication, incomplete summaries after partial failure, and isolation
342
364
  from Node preload, PATH replacement, external npm configuration, unrelated secrets
343
365
  and token-bearing child-process errors. Credentials must live in the
344
- `npm-staging` environment restricted to the default branch. The remote environment
345
- is configured with one Branch rule for `main`, no Tag rules, and the
366
+ `npm-staging` environment, originally restricted to the default branch. That setup
367
+ used one Branch rule for `main`, no Tag rules, and the
346
368
  maintainer-provided stage-only token stored as environment secret `NPM_STAGE_TOKEN`.
347
369
  The environment and secret metadata were read back; no repository-level copy of
348
370
  the secret was created. See [publishing setup](publishing.md#staging-credentials).
349
371
 
350
372
  Real npm **11.21.2** ran against a temporary loopback registry with fake tokens.
351
373
  It wrote only to staging endpoints, uploaded identical tarball bytes and skipped
352
- lifecycle scripts. No live npm staging or approval has been executed. Initial
374
+ lifecycle scripts. At that review no live npm staging or approval had been executed. Initial
353
375
  publication of all nine real versions was performed personally by the maintainer.
354
376
 
355
377
  Further regressions reject malicious tarballs even with self-consistent hashes:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goldenpigeon/dsh-eu4-indexer",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Manage and query EU4 and HOI4 game and mod indexes in DeepSeek Harness, with isolated query sessions.",
5
5
  "type": "module",
6
6
  "license": "MIT",