@hagicode/hagitask 0.1.0-dev.26 → 0.1.0-dev.28

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 (2) hide show
  1. package/README.md +17 -138
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -5,13 +5,14 @@
5
5
  [![license](https://img.shields.io/npm/l/%40hagicode%2Fhagitask?color=ffd43b)](https://www.npmjs.com/package/@hagicode/hagitask)
6
6
  [![Node.js](https://img.shields.io/badge/node-%3E%3D24.0.0-339933?logo=node.js&logoColor=white)](https://nodejs.org/)
7
7
 
8
- HagiTask is the canonical repository for preset-task contribution assets inside the
9
- HagiCode monorepo. It is the maintained source of truth for shipped preset-task
10
- schemas and preset packages.
8
+ HagiTask is the offline toolkit for authoring HagiTask preset-task packages. It ships a
9
+ `hagitask validate` command that checks packages against the shipped schemas, a
10
+ `hagitask new` command that scaffolds a package, a validation API, and the preset
11
+ packages `normal-session` and `research-investigation`.
11
12
 
12
13
  ## npm CLI
13
14
 
14
- The repository is also published as `@hagicode/hagitask` (Node.js 24 or newer).
15
+ The toolkit is published as `@hagicode/hagitask` (Node.js 24 or newer).
15
16
  Install it with `npm install --save-dev @hagicode/hagitask`, then validate a
16
17
  repository or one package:
17
18
 
@@ -44,57 +45,18 @@ a directory containing `manifest.json`. It returns exit code `0` only when all
44
45
  discovered packages pass. Human-readable diagnostics are printed by default;
45
46
  `--json` prints the stable `{ packages, errors, valid }` result on stdout for CI.
46
47
  Validation reads `schemas/` shipped inside the npm package (and never requires a
47
- network connection). The CLI is the new reusable validator; Contrib and Community
48
- Packages retain their existing workflows until a separate migration.
49
-
50
- > Authoring location: contributors add and update preset-task packages **here**, in
51
- > `repos/hagitask`, not in `repos/hagicode-core/src/PCode.Web/plugins/task-presets/`.
52
- > The `hagicode-core` copy is a transitional asset that is kept only until the backend
53
- > loading cutover lands.
54
-
55
- ## Repository Layout
56
-
57
- ```text
58
- repos/hagitask/
59
- schemas/
60
- task-preset-plugin/
61
- manifest.schema.json # Preset package manifest contract
62
- panel.schema.json # Frontend panel definition contract
63
- commands.schema.json # Frontend command catalog contract
64
- locales.schema.json # Locale bundle contract
65
- task-preset.schema.json # Backend task-preset contract
66
- prompt-package.schema.json # Backend prompt package contract
67
- store-page-frontmatter.schema.json # Store-page frontmatter contract
68
- community-index-v1.schema.json # Published /index.json contract
69
- community-task-detail-v1.schema.json # Published /tasks/<taskId>.json contract
70
- presets/
71
- <presetTaskId>/
72
- manifest.json
73
- frontend/
74
- panel.json
75
- commands.json # Optional, only when the preset ships commands
76
- backend/
77
- task-preset.json
78
- prompts.json
79
- templates/<locale>/...
80
- locales/
81
- en-US.json
82
- zh-CN.json
83
- store-page/
84
- index.en-US.md
85
- index.zh-CN.md
86
- ```
48
+ network connection).
87
49
 
88
50
  ## Schema Layers
89
51
 
90
52
  `schemas/` holds three schema layers. They validate different documents, at different
91
- points in the pipeline, and are owned by different producers.
53
+ points in the pipeline.
92
54
 
93
- | Layer | Schemas | Validates | Produced by |
94
- | --- | --- | --- | --- |
95
- | Package schemas | `schemas/task-preset-plugin/*.schema.json` | the JSON files inside a preset or community package (`manifest.json`, `frontend/*`, `backend/*`, `locales/*`) | contributors, by hand |
96
- | Community discovery schema | `schemas/community-index-v1.schema.json` | the published `/index.json` catalog | `hagitask-site` build |
97
- | Community detail schema | `schemas/community-task-detail-v1.schema.json` | each published `/tasks/<taskId>.json` document | `hagitask-site` build |
55
+ | Layer | Schemas | Validates |
56
+ | --- | --- | --- |
57
+ | Package schemas | `schemas/task-preset-plugin/*.schema.json` | the JSON files inside a preset or community package (`manifest.json`, `frontend/*`, `backend/*`, `locales/*`) |
58
+ | Community discovery schema | `schemas/community-index-v1.schema.json` | the published `/index.json` catalog |
59
+ | Community detail schema | `schemas/community-task-detail-v1.schema.json` | each published `/tasks/<taskId>.json` document |
98
60
 
99
61
  Package schemas describe **authored source**. The community schemas describe
100
62
  **generated publication output** and carry fields that do not exist in any package file
@@ -102,23 +64,11 @@ Package schemas describe **authored source**. The community schemas describe
102
64
  wrong layer is the most common source of confusion: if you are editing a file inside a
103
65
  package directory, the matching contract is always under `schemas/task-preset-plugin/`.
104
66
 
105
- Community packages live in
106
- [`hagitask-community-packages`](https://github.com/HagiCode-org/hagitask-community-packages).
107
- That repository mounts HagiTask as a **nested submodule** and consumes these schemas
108
- directly from `hagitask/schemas/task-preset-plugin/` — it no longer vendors its own copy.
109
- [`hagitask-site`](https://github.com/HagiCode-org/hagitask-site) in turn mounts the
110
- community repository as its `community-packages/` submodule, reads task packages from
111
- `community-packages/data/`, and loads the publication schemas from
112
- `community-packages/hagitask/schemas`. Shipped presets live in `presets/` in this
113
- repository. All three — HagiTask presets, community packages, and the site build — use the
114
- same package schemas from this directory.
115
-
116
67
  ## Package `$schema` Reference
117
68
 
118
69
  `schemas/task-preset-plugin/` is the authoritative home for the JSON schemas that
119
70
  validate preset packages. Every shipped and community preset package resolves its
120
- `$schema` references against this directory, so contributors never need files from
121
- `repos/hagicode-core` to validate a package.
71
+ `$schema` references against this directory.
122
72
 
123
73
  The shipped preset packages use these relative `$schema` paths from inside
124
74
  `presets/<presetTaskId>/`:
@@ -238,65 +188,12 @@ A package that wants to state the scope declares both in `backend/prompts.json`:
238
188
  - **The backend supplies the values.** They are not creation parameters: package panels,
239
189
  `inputBindings` and create requests must not declare or send them.
240
190
 
241
- ## Publication Data Flow
242
-
243
- ```mermaid
244
- flowchart LR
245
- SRC["Community package source<br/>data/&lt;taskId&gt;/manifest.json, frontend/, backend/, locales/, store-page/"]
246
- PKG["Package schemas<br/>hagitask/schemas/task-preset-plugin/*.schema.json"]
247
- SUB["hagitask-site community-packages/ submodule (nested hagitask)"]
248
- NORM["Site build: normalize + digest"]
249
- IDX["/index.json"]
250
- DET["/tasks/&lt;taskId&gt;.json"]
251
- ZIP["/packages/&lt;taskId&gt;.zip"]
252
- CIDX["community-index-v1.schema.json"]
253
- CDET["community-task-detail-v1.schema.json"]
254
-
255
- PKG -.validates.-> SRC
256
- SRC --> SUB --> NORM
257
- NORM --> IDX
258
- NORM --> DET
259
- NORM --> ZIP
260
- CIDX -.validates.-> IDX
261
- CDET -.validates.-> DET
262
- ```
263
-
264
- How source edits reach the published documents:
265
-
266
- | Source change | Affected published fields |
267
- | --- | --- |
268
- | `manifest.json` → `version` | `version` in index and detail |
269
- | `manifest.json` → `owner` | `publisher` in index and detail |
270
- | `backend/task-preset.json` → `requirements` | `requirements` in detail, and the derived `compatibility.agent` / `.skills` / `.cli` in both documents |
271
- | `store-page/index.<locale>.md` → `title` / `summary` | `name`, `summary`, `description`, and `localization.supportedLocales` |
272
- | `store-page/index.en-US.md` → `catalog` / `tags` | `category` and `tags` |
273
- | any file in the package directory | the zip contents, plus `integrity.sha256` in the index and `installation.size` / `installation.sha256` in the detail |
274
-
275
- ## Generated Output Is Not Editable
276
-
277
- `/index.json`, `/tasks/<taskId>.json`, and `/packages/<taskId>.zip` are produced from
278
- scratch on every site build. They are not stored in any repository as editable source and
279
- hand edits are discarded on the next publish. The only way to change a published field is
280
- to change the package file it is derived from.
281
-
282
- When schema validation fails:
283
-
284
- 1. Read which document failed. A `task-preset-plugin` failure points at a package file you
285
- authored; a `community-index-v1` or `community-task-detail-v1` failure means the site
286
- build normalized your source into something that violates the publication contract.
287
- 2. Fix the source package file. Do not relax `$schema`, delete the `$schema` reference,
288
- skip validation, or patch the generated output.
289
- 3. Re-run the site build to confirm the fix.
290
- 4. If the package data is genuinely correct and the schema is wrong, change the schema
291
- **here**, in this repository, as a deliberate contract change.
292
-
293
191
  ## Preset Package Directory
294
192
 
295
193
  `presets/` is the root for preset-task packages. Each package lives in its own
296
194
  `presets/<presetTaskId>/` directory and preserves the loader-compatible plugin
297
195
  package shape (`manifest.json`, `frontend/`, `backend/`, `locales/`, and
298
- `store-page/`). This means the backend can load migrated packages without a
299
- HagiTask-specific adapter.
196
+ `store-page/`).
300
197
 
301
198
  Currently shipped packages:
302
199
 
@@ -308,24 +205,9 @@ Currently shipped packages:
308
205
  [`hagitask-community-packages`](https://github.com/HagiCode-org/hagitask-community-packages),
309
206
  not in `presets/`.
310
207
 
311
- ## Source-of-Truth Ownership
312
-
313
- HagiTask owns preset-task schemas and shipped preset packages. When you add a new
314
- preset, update an existing one, or change a schema, do it here.
315
-
316
- The legacy copies under `repos/hagicode-core/src/PCode.Web/plugins/task-presets/`
317
- are kept unchanged during the copy-first transition phase. After the later backend
318
- loading cutover (see `openspec/changes/migrate-preset-task-to-hagitask-repo`),
319
- `hagicode-core` will load shipped presets from `repos/hagitask/presets` through the
320
- `TaskPresetPlugins.PresetGroups` configuration and the backend-owned copy will no
321
- longer be the shipped source of truth.
322
-
323
- Until that cutover lands, every shipped preset update — including `openspec-spec-compress` —
324
- must keep the `hagicode-core` runtime copy synchronized with the canonical HagiTask package.
325
-
326
208
  ## Contributing a Preset Package
327
209
 
328
- HagiTask owns the Schema and shipped preset source. Preset packages use the loader-compatible
210
+ Preset packages use the loader-compatible
329
211
  layout described above and must keep their JSON resources aligned with
330
212
  `schemas/task-preset-plugin/`. Validate authored files against those schemas before submitting:
331
213
 
@@ -334,14 +216,11 @@ npm run validate
334
216
  ```
335
217
 
336
218
  The validator checks every shipped preset, all manifest resource references, package
337
- JSON schemas, prompt template references, and compatibility binding aliases. It is
338
- intentionally package-local so the same command can run in a clean checkout without
339
- depending on Core or site-generated output.
219
+ JSON schemas, prompt template references, and compatibility binding aliases.
340
220
 
341
221
  For the user-facing walkthrough covering package creation, locale and store-page resources,
342
222
  validation, semantic versioning, and Pull Requests, see the
343
223
  [HagiTask community guide](https://docs.hagicode.com/guides/hagitask/community/). A community
344
224
  task belongs in
345
225
  [`hagitask-community-packages`](https://github.com/HagiCode-org/hagitask-community-packages),
346
- not in this repository. This README remains the technical reference for Schema ownership,
347
- preset source data, and the transitional runtime copy.
226
+ not in this repository.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hagicode/hagitask",
3
- "version": "0.1.0-dev.26",
3
+ "version": "0.1.0-dev.28",
4
4
  "description": "Offline HagiTask package schemas, validation API, and CLI.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -53,7 +53,7 @@
53
53
  "registry": "https://registry.npmjs.org/"
54
54
  },
55
55
  "scripts": {
56
- "build": "tsc -p tsconfig.json",
56
+ "build": "export NODE_OPTIONS=\"${NODE_OPTIONS:-} --max-old-space-size=4096\"; tsc -p tsconfig.json",
57
57
  "test": "npm run build && node --test test/*.test.mjs",
58
58
  "validate": "npm run build && node dist/cli.js validate .",
59
59
  "clean": "rm -rf dist"