@hasna/instructions 0.3.1 → 0.4.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.
Files changed (63) hide show
  1. package/README.md +43 -12
  2. package/dashboard/README.md +73 -0
  3. package/dist/cli/index.js +1305 -837
  4. package/dist/data/config-store.d.ts +134 -0
  5. package/dist/data/config-store.d.ts.map +1 -0
  6. package/dist/data/config-store.test.d.ts +2 -0
  7. package/dist/data/config-store.test.d.ts.map +1 -0
  8. package/dist/db/database.d.ts +15 -0
  9. package/dist/db/database.d.ts.map +1 -1
  10. package/dist/index.d.ts +6 -8
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +908 -492
  13. package/dist/lib/apply.d.ts +2 -2
  14. package/dist/lib/apply.d.ts.map +1 -1
  15. package/dist/lib/export.d.ts +2 -2
  16. package/dist/lib/export.d.ts.map +1 -1
  17. package/dist/lib/import.d.ts +2 -2
  18. package/dist/lib/import.d.ts.map +1 -1
  19. package/dist/lib/package-manager-guard.d.ts +24 -0
  20. package/dist/lib/package-manager-guard.d.ts.map +1 -0
  21. package/dist/lib/package-manager-guard.test.d.ts +2 -0
  22. package/dist/lib/package-manager-guard.test.d.ts.map +1 -0
  23. package/dist/lib/platform-profiles.d.ts +2 -2
  24. package/dist/lib/platform-profiles.d.ts.map +1 -1
  25. package/dist/lib/project-dashboard-standard.d.ts +2 -2
  26. package/dist/lib/project-dashboard-standard.d.ts.map +1 -1
  27. package/dist/lib/redact.d.ts.map +1 -1
  28. package/dist/lib/sync-dir.d.ts +3 -3
  29. package/dist/lib/sync-dir.d.ts.map +1 -1
  30. package/dist/lib/sync.d.ts +6 -6
  31. package/dist/lib/sync.d.ts.map +1 -1
  32. package/dist/mcp/http.d.ts +0 -13
  33. package/dist/mcp/http.d.ts.map +1 -1
  34. package/dist/mcp/index.js +661 -574
  35. package/dist/mcp/server.d.ts.map +1 -1
  36. package/dist/server/index.d.ts.map +1 -1
  37. package/dist/server/index.js +1757 -17541
  38. package/dist/server/v1.d.ts.map +1 -1
  39. package/dist/status.d.ts +2 -2
  40. package/dist/status.d.ts.map +1 -1
  41. package/dist/storage/cloud-store.d.ts +21 -1
  42. package/dist/storage/cloud-store.d.ts.map +1 -1
  43. package/dist/storage/schema.d.ts.map +1 -1
  44. package/package.json +4 -7
  45. package/dashboard/dist/assets/index-D7p6fFQw.js +0 -11
  46. package/dashboard/dist/assets/index-DQ3P1g1z.css +0 -1
  47. package/dashboard/dist/index.html +0 -14
  48. package/dashboard/dist/vite.svg +0 -1
  49. package/dist/cli/storage.d.ts +0 -3
  50. package/dist/cli/storage.d.ts.map +0 -1
  51. package/dist/cli/storage.test.d.ts +0 -2
  52. package/dist/cli/storage.test.d.ts.map +0 -1
  53. package/dist/db/remote-storage.d.ts +0 -13
  54. package/dist/db/remote-storage.d.ts.map +0 -1
  55. package/dist/db/storage-sync.d.ts +0 -53
  56. package/dist/db/storage-sync.d.ts.map +0 -1
  57. package/dist/db/storage-sync.test.d.ts +0 -2
  58. package/dist/db/storage-sync.test.d.ts.map +0 -1
  59. package/dist/server/server.test.d.ts +0 -2
  60. package/dist/server/server.test.d.ts.map +0 -1
  61. package/dist/storage.d.ts +0 -5
  62. package/dist/storage.d.ts.map +0 -1
  63. package/dist/storage.js +0 -537
package/README.md CHANGED
@@ -27,6 +27,8 @@ instructions show <slug> # full metadata + content
27
27
  instructions inspect <slug> # alias for show
28
28
  instructions profile resolve
29
29
  instructions profile apply --auto
30
+ instructions package-manager-scan --fail-on-findings .
31
+ instructions package-manager-scan --home --fail-on-findings .
30
32
  ```
31
33
 
32
34
  Collection commands are compact by default to keep agent terminals and context
@@ -37,6 +39,36 @@ small. Human output is capped at 20 rows unless you pass `--limit`; use
37
39
  - `--json` preserves full machine-readable records for automation.
38
40
  - `show`/`inspect` and `snapshot show` print full config or snapshot content.
39
41
 
42
+ ## Package-Manager Secret Guard
43
+
44
+ `instructions package-manager-scan` blocks package-manager credential ingress without
45
+ printing credential values. It scans repo `.npmrc` files, home `.npmrc`, Bun
46
+ config, lockfiles, and shell profiles, then reports only path, line, rule,
47
+ surface, and tracked status.
48
+
49
+ Use it in CI or pre-commit hooks:
50
+
51
+ ```bash
52
+ instructions package-manager-scan --fail-on-findings .
53
+ ```
54
+
55
+ Use `--home` for local operator scans:
56
+
57
+ ```bash
58
+ instructions package-manager-scan --home --fail-on-findings .
59
+ ```
60
+
61
+ Safe `.npmrc` auth uses npm's environment reference, not a rendered literal:
62
+
63
+ ```ini
64
+ @hasna:registry=https://registry.npmjs.org/
65
+ # Add the npm auth-token entry with an environment reference, not a literal value.
66
+ ```
67
+
68
+ Bun release-age quarantine must stay enabled. Keep
69
+ `minimumReleaseAgeExcludes` narrowed to exact `@hasna/<package>` names only;
70
+ wildcards and third-party package names fail the guard.
71
+
40
72
  ## MCP Server
41
73
 
42
74
  ```bash
@@ -102,21 +134,20 @@ and `API_KEY_SIGNING_SECRET` are also accepted). Client apps use
102
134
  `InstructionsV1Client` is generated from the serve OpenAPI document
103
135
  (`bun run generate:sdk`).
104
136
 
105
- ## Storage Sync (local CLI)
137
+ ## Storage Modes
106
138
 
107
- The local CLI supports optional remote storage sync through a package-local
108
- Postgres connection:
139
+ Every CLI command, MCP tool, and SDK method routes through a single `ConfigStore`
140
+ abstraction with two transports:
109
141
 
110
- ```bash
111
- export HASNA_INSTRUCTIONS_DATABASE_URL=postgres://...
112
- instructions storage status
113
- instructions storage push
114
- instructions storage pull
115
- instructions storage sync
116
- ```
142
+ - **local** — on-box SQLite (`LocalConfigStore`), fully first-class. Used when no
143
+ API env vars are set.
144
+ - **api** (self_hosted / cloud) — HTTP `/v1` + bearer key (`CloudConfigStore`).
145
+ Activated by setting **both** `HASNA_INSTRUCTIONS_API_URL` and
146
+ `HASNA_INSTRUCTIONS_API_KEY`. Identical client code; only the URL/key differ,
147
+ and the self_hosted/cloud distinction is enforced server-side by tenancy.
117
148
 
118
- The MCP server also exposes `storage_status`, `storage_push`, `storage_pull`, and
119
- `storage_sync`.
149
+ Clients never hold a database DSN. The raw Postgres connection is a server-only
150
+ concern (`instructions-serve`).
120
151
 
121
152
  ## Data Directory
122
153
 
@@ -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
+ ```