@hasna/instructions 0.4.7 → 0.4.8

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 (38) hide show
  1. package/README.md +52 -0
  2. package/dashboard/README.md +73 -0
  3. package/dist/cli/index.js +8543 -862
  4. package/dist/cli/project-context.test.d.ts +2 -0
  5. package/dist/cli/project-context.test.d.ts.map +1 -0
  6. package/dist/data/config-store.d.ts +13 -0
  7. package/dist/data/config-store.d.ts.map +1 -1
  8. package/dist/index.d.ts +10 -8
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +8498 -891
  11. package/dist/lib/apply.d.ts +20 -0
  12. package/dist/lib/apply.d.ts.map +1 -1
  13. package/dist/lib/global-agent-rules-render-integration.test.d.ts +2 -0
  14. package/dist/lib/global-agent-rules-render-integration.test.d.ts.map +1 -0
  15. package/dist/lib/global-agent-rules-standard.d.ts +52 -1
  16. package/dist/lib/global-agent-rules-standard.d.ts.map +1 -1
  17. package/dist/lib/machine.d.ts +4 -0
  18. package/dist/lib/machine.d.ts.map +1 -1
  19. package/dist/lib/platform-profiles.d.ts.map +1 -1
  20. package/dist/lib/project-context.d.ts +440 -0
  21. package/dist/lib/project-context.d.ts.map +1 -0
  22. package/dist/lib/project-context.test.d.ts +2 -0
  23. package/dist/lib/project-context.test.d.ts.map +1 -0
  24. package/dist/lib/session-apply.d.ts +35 -0
  25. package/dist/lib/session-apply.d.ts.map +1 -1
  26. package/dist/lib/session-render-contract.d.ts +5 -0
  27. package/dist/lib/session-render-contract.d.ts.map +1 -0
  28. package/dist/lib/session-render.d.ts +51 -4
  29. package/dist/lib/session-render.d.ts.map +1 -1
  30. package/dist/lib/sync-dir.d.ts.map +1 -1
  31. package/dist/lib/sync.d.ts.map +1 -1
  32. package/dist/lib/template.d.ts +4 -0
  33. package/dist/lib/template.d.ts.map +1 -1
  34. package/dist/mcp/index.js +4740 -231
  35. package/dist/mcp/server.d.ts.map +1 -1
  36. package/dist/types/index.d.ts +1 -0
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/package.json +3 -2
package/README.md CHANGED
@@ -192,6 +192,58 @@ manifests for drift, refuses unmanaged file conflicts unless `--force` is
192
192
  passed, removes stale managed mirrors only when safe, and writes local snapshots
193
193
  before mutating managed files.
194
194
 
195
+ ### Managed project context
196
+
197
+ `instructions project-context plan|apply` is the sole writer for the strict
198
+ `hasna.projects.project_context_bundle.v1` contract emitted by Projects. It
199
+ accepts bounded structured JSON from a regular file or stdin and never invokes
200
+ Projects, Todos, Conversations, or Mementos while rendering:
201
+
202
+ ```bash
203
+ projects context-bundle <project-id> --json > ./project-context.json
204
+ instructions project-context plan \
205
+ --runtime codewith \
206
+ --workspace-root /absolute/workspace \
207
+ --bundle ./project-context.json \
208
+ --json
209
+ instructions project-context apply \
210
+ --runtime codewith \
211
+ --workspace-root /absolute/workspace \
212
+ --bundle ./project-context.json \
213
+ --json
214
+ ```
215
+
216
+ The renderer writes one canonical `.hasna/instructions/project-context.md`
217
+ fragment, then a managed import in `CLAUDE.md`, a managed inline block in
218
+ `AGENTS.md`, and a managed inline block in `.codewith/CODEWITH.md` by default.
219
+ Codewith uses an import only when its existing
220
+ `HASNA_CONFIGS_CODEWITH_NATIVE_IMPORTS=1` capability gate is active or
221
+ `--codewith-native-imports` explicitly selects that supported runtime mode.
222
+ Bytes outside the managed marker pair are preserved. Codewith's
223
+ `.codewith/CODEWITH.override.md` takes precedence and causes the stable
224
+ `PROJECT_CONTEXT_SHADOWED` failure instead of an ignored write.
225
+ Existing Instructions session manifests are updated additively, and later
226
+ `instructions session plan|apply` runs recompose the validated durable project
227
+ context so routine Claude, Codewith, or Codex rerenders cannot discard it.
228
+
229
+ Input is limited to 8 KiB, output to 4 KiB and six allowlisted argv commands.
230
+ The writer rejects unknown fields, hash/revision inconsistencies, credentials,
231
+ URLs, symlinks, malformed or conflicting markers, and older revisions. Applies
232
+ use a per-workspace lock, compare-and-swap hashes, same-directory fsynced temp
233
+ files and renames, and a metadata-only manifest written last. Existing-file
234
+ updates require an atomic exchange primitive (Linux `renameat2` or macOS
235
+ `renameatx_np`); unsupported platforms, including Windows, fail closed before
236
+ replacement rather than approximating an exchange. A same-project,
237
+ compatible last-known-good cache can be selected explicitly with
238
+ `--allow-stale-cache --expected-project-id <id>`; its bounded age/status is
239
+ visible in the rendered context.
240
+
241
+ Compatibility remains additive: project-context manifests keep
242
+ `hasna.configs.session-render/v1`, `Managed by @hasna/configs`, and
243
+ `ownedBy: open-configs`, while recording `canonicalOwner: instructions`. The
244
+ legacy `@hasna/configs` 0.2.45 `configs` executable remains available as a bin
245
+ alias; no separate Configs repository or flag-day manifest v2 is introduced.
246
+
195
247
  `instructions init` and `bun run seed` also seed
196
248
  `global-agent-rules-standard`, the managed global/system prompt source for
197
249
  session renaming, task-scoped worktrees, PR-first landing, protected-branch
@@ -0,0 +1,73 @@
1
+ # React + TypeScript + Vite
2
+
3
+ This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
4
+
5
+ Currently, two official plugins are available:
6
+
7
+ - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
+ - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
9
+
10
+ ## React Compiler
11
+
12
+ The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
13
+
14
+ ## Expanding the ESLint configuration
15
+
16
+ If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
17
+
18
+ ```js
19
+ export default defineConfig([
20
+ globalIgnores(['dist']),
21
+ {
22
+ files: ['**/*.{ts,tsx}'],
23
+ extends: [
24
+ // Other configs...
25
+
26
+ // Remove tseslint.configs.recommended and replace with this
27
+ tseslint.configs.recommendedTypeChecked,
28
+ // Alternatively, use this for stricter rules
29
+ tseslint.configs.strictTypeChecked,
30
+ // Optionally, add this for stylistic rules
31
+ tseslint.configs.stylisticTypeChecked,
32
+
33
+ // Other configs...
34
+ ],
35
+ languageOptions: {
36
+ parserOptions: {
37
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
+ tsconfigRootDir: import.meta.dirname,
39
+ },
40
+ // other options...
41
+ },
42
+ },
43
+ ])
44
+ ```
45
+
46
+ You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
+
48
+ ```js
49
+ // eslint.config.js
50
+ import reactX from 'eslint-plugin-react-x'
51
+ import reactDom from 'eslint-plugin-react-dom'
52
+
53
+ export default defineConfig([
54
+ globalIgnores(['dist']),
55
+ {
56
+ files: ['**/*.{ts,tsx}'],
57
+ extends: [
58
+ // Other configs...
59
+ // Enable lint rules for React
60
+ reactX.configs['recommended-typescript'],
61
+ // Enable lint rules for React DOM
62
+ reactDom.configs.recommended,
63
+ ],
64
+ languageOptions: {
65
+ parserOptions: {
66
+ project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
+ tsconfigRootDir: import.meta.dirname,
68
+ },
69
+ // other options...
70
+ },
71
+ },
72
+ ])
73
+ ```