@hasna/instructions 0.4.26 → 0.4.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.
package/dist/mcp/index.js CHANGED
@@ -5729,11 +5729,13 @@ function isSafeSingleLine(value) {
5729
5729
  function isSafeCommandArgument(value) {
5730
5730
  return /^[A-Za-z0-9_./:@+=,-]+$/.test(value) && !value.includes("://") && !value.startsWith("-") || /^--[a-z][a-z0-9-]*$/.test(value);
5731
5731
  }
5732
- var PROJECT_CONTEXT_SCHEMA = "hasna.projects.project_context_bundle.v1", PROJECT_CONTEXT_MAX_INPUT_BYTES, PROJECT_CONTEXT_MAX_RENDERED_BYTES, PROJECT_CONTEXT_MAX_COMMANDS = 6, PROJECT_CONTEXT_FRAGMENT_PATH = ".hasna/instructions/project-context.md", PROJECT_CONTEXT_CACHE_SCHEMA = "hasna.instructions.project-context-cache/v1", SESSION_COMPATIBILITY_MANIFEST_MAX_BYTES, FOREIGN_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_WARN_BYTES, PROJECT_CONTEXT_LOCK_STALE_MS, PROJECT_KINDS, PROJECT_STATUSES, LINK_STATES, RESOLUTION_SOURCES, safeId, nullableId, producerSlug, producerName, safeOptionalDisplay, isoTimestamp, revisionSchema, hashSchema, absolutePath, commandArg, commandSchema, projectContextBundleSchema, storedManifestProjectContextSchema, storedManifestFileSchema, storedManifestObservationSchema, projectContextMetadataSnapshotSchema, projectContextCacheSchema;
5732
+ var PROJECT_CONTEXT_SCHEMA = "hasna.projects.project_context_bundle.v1", PROJECT_CONTEXT_SCHEMA_V2 = "hasna.projects.project_context_bundle.v2", PROJECT_CONTEXT_SUPPORTED_SCHEMAS, projectContextSchema, PROJECT_CONTEXT_MAX_INPUT_BYTES, PROJECT_CONTEXT_MAX_RENDERED_BYTES, PROJECT_CONTEXT_MAX_COMMANDS = 6, PROJECT_CONTEXT_FRAGMENT_PATH = ".hasna/instructions/project-context.md", PROJECT_CONTEXT_CACHE_SCHEMA = "hasna.instructions.project-context-cache/v1", SESSION_COMPATIBILITY_MANIFEST_MAX_BYTES, FOREIGN_INPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_MAX_BYTES, SESSION_MANAGED_OUTPUT_WARN_BYTES, PROJECT_CONTEXT_LOCK_STALE_MS, PROJECT_KINDS, PROJECT_STATUSES, LINK_STATES, RESOLUTION_SOURCES, safeId, nullableId, producerSlug, producerName, safeOptionalDisplay, isoTimestamp, revisionSchema, hashSchema, absolutePath, commandArg, financeText, financeLegalEntity, financeProjectMetadataSchema, commandSchema, projectContextBundleSchema, storedManifestProjectContextSchema, storedManifestFileSchema, storedManifestObservationSchema, projectContextMetadataSnapshotSchema, projectContextCacheSchema;
5733
5733
  var init_project_context = __esm(() => {
5734
5734
  init_zod();
5735
5735
  init_redact();
5736
5736
  init_session_render_contract();
5737
+ PROJECT_CONTEXT_SUPPORTED_SCHEMAS = [PROJECT_CONTEXT_SCHEMA, PROJECT_CONTEXT_SCHEMA_V2];
5738
+ projectContextSchema = exports_external.enum(PROJECT_CONTEXT_SUPPORTED_SCHEMAS);
5737
5739
  PROJECT_CONTEXT_MAX_INPUT_BYTES = 8 * 1024;
5738
5740
  PROJECT_CONTEXT_MAX_RENDERED_BYTES = 4 * 1024;
5739
5741
  SESSION_COMPATIBILITY_MANIFEST_MAX_BYTES = 8 * 1024 * 1024;
@@ -5767,12 +5769,34 @@ var init_project_context = __esm(() => {
5767
5769
  hashSchema = exports_external.string().regex(/^sha256:[a-f0-9]{64}$/);
5768
5770
  absolutePath = exports_external.string().min(1).max(4096).refine((value) => isAbsolute(value), "must be absolute").refine(isSafeSingleLine, "must be safe").nullable();
5769
5771
  commandArg = exports_external.string().min(1).max(1024).refine((value) => isSafeCommandArgument(value), "unsafe argv item");
5772
+ financeText = exports_external.string().min(1).max(512).refine((value) => value === value.trim(), "must be normalized");
5773
+ financeLegalEntity = exports_external.string().min(1).max(256).refine((value) => value === value.trim(), "must be normalized");
5774
+ financeProjectMetadataSchema = exports_external.object({
5775
+ schema: exports_external.literal("hasna.projects.finance_project_metadata.v1"),
5776
+ business_area: exports_external.literal("finance"),
5777
+ jurisdiction: exports_external.string().min(2).max(64).regex(/^[A-Z0-9][A-Z0-9._:-]{1,63}$/),
5778
+ legal_entities: exports_external.array(financeLegalEntity).min(1).max(100).refine((values) => new Set(values).size === values.length, "must not contain duplicate legal entities"),
5779
+ fiscal_cycle: exports_external.enum(["monthly", "quarterly", "annual", "event-driven"]),
5780
+ data_classification: exports_external.enum(["public", "internal", "confidential", "restricted"]),
5781
+ retention_policy: financeText,
5782
+ ledger_authority: financeText,
5783
+ evidence_store: financeText,
5784
+ approver: financeText,
5785
+ external_recipient_policy: financeText
5786
+ }).strict().superRefine((value, context) => {
5787
+ if (Buffer.byteLength(JSON.stringify(value), "utf8") > 4 * 1024) {
5788
+ context.addIssue({
5789
+ code: exports_external.ZodIssueCode.custom,
5790
+ message: "finance project metadata exceeds the 4 KiB producer context budget"
5791
+ });
5792
+ }
5793
+ });
5770
5794
  commandSchema = exports_external.object({
5771
5795
  name: exports_external.enum(["show", "context", "why", "context-bundle"]),
5772
5796
  argv: exports_external.array(commandArg).min(1).max(8)
5773
5797
  }).strict();
5774
5798
  projectContextBundleSchema = exports_external.object({
5775
- schema: exports_external.literal(PROJECT_CONTEXT_SCHEMA),
5799
+ schema: projectContextSchema,
5776
5800
  generated_at: isoTimestamp,
5777
5801
  hash: hashSchema,
5778
5802
  revision: revisionSchema,
@@ -5795,7 +5819,8 @@ var init_project_context = __esm(() => {
5795
5819
  kind: exports_external.enum(PROJECT_KINDS),
5796
5820
  status: exports_external.enum(PROJECT_STATUSES),
5797
5821
  path: absolutePath,
5798
- updated_at: isoTimestamp
5822
+ updated_at: isoTimestamp,
5823
+ finance: financeProjectMetadataSchema.optional()
5799
5824
  }).strict(),
5800
5825
  links: exports_external.object({
5801
5826
  todos: exports_external.object({
@@ -5818,9 +5843,17 @@ var init_project_context = __esm(() => {
5818
5843
  machine_id: nullableId
5819
5844
  }).strict().nullable(),
5820
5845
  commands: exports_external.array(commandSchema).max(PROJECT_CONTEXT_MAX_COMMANDS)
5821
- }).strict();
5846
+ }).strict().superRefine((bundle, context) => {
5847
+ if (bundle.schema === PROJECT_CONTEXT_SCHEMA && bundle.project.finance !== undefined) {
5848
+ context.addIssue({
5849
+ code: exports_external.ZodIssueCode.custom,
5850
+ path: ["project", "finance"],
5851
+ message: "finance project metadata requires project-context bundle v2"
5852
+ });
5853
+ }
5854
+ });
5822
5855
  storedManifestProjectContextSchema = exports_external.object({
5823
- schema: exports_external.literal(PROJECT_CONTEXT_SCHEMA),
5856
+ schema: projectContextSchema,
5824
5857
  projectId: safeId,
5825
5858
  revision: revisionSchema,
5826
5859
  hash: hashSchema,
@@ -7258,7 +7291,7 @@ var init_sync_dir = __esm(() => {
7258
7291
  var require_package = __commonJS((exports, module) => {
7259
7292
  module.exports = {
7260
7293
  name: "@hasna/instructions",
7261
- version: "0.4.26",
7294
+ version: "0.4.28",
7262
7295
  description: "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
7263
7296
  type: "module",
7264
7297
  main: "dist/index.js",
@@ -3141,6 +3141,27 @@ function buildV1OpenApiDocument(version = getPackageVersion()) {
3141
3141
  variables: { type: "object" }
3142
3142
  }
3143
3143
  },
3144
+ AddProfileConfigInput: {
3145
+ type: "object",
3146
+ required: ["config_id"],
3147
+ properties: {
3148
+ config_id: { type: "string" }
3149
+ }
3150
+ },
3151
+ ProfileConfigAddedResponse: {
3152
+ type: "object",
3153
+ required: ["added"],
3154
+ properties: {
3155
+ added: { type: "boolean", const: true }
3156
+ }
3157
+ },
3158
+ ProfileConfigRemovedResponse: {
3159
+ type: "object",
3160
+ required: ["removed"],
3161
+ properties: {
3162
+ removed: { type: "boolean", const: true }
3163
+ }
3164
+ },
3144
3165
  ProfileWithConfigs: {
3145
3166
  type: "object",
3146
3167
  properties: {
@@ -3378,6 +3399,55 @@ function buildV1OpenApiDocument(version = getPackageVersion()) {
3378
3399
  responses: { "200": { content: { "application/json": { schema: { type: "object", properties: { deleted: { type: "boolean" }, id: { type: "string" } } } } } } }
3379
3400
  }
3380
3401
  },
3402
+ "/v1/profiles/{id}/configs": {
3403
+ post: {
3404
+ operationId: "addConfigToProfile",
3405
+ summary: "Add a config to a profile",
3406
+ description: "Requires an API key with the `instructions:write` scope.",
3407
+ security: [{ apiKey: [] }],
3408
+ parameters: [
3409
+ { name: "id", in: "path", required: true, schema: { type: "string" } }
3410
+ ],
3411
+ requestBody: {
3412
+ required: true,
3413
+ content: {
3414
+ "application/json": {
3415
+ schema: { $ref: "#/components/schemas/AddProfileConfigInput" }
3416
+ }
3417
+ }
3418
+ },
3419
+ responses: {
3420
+ "200": {
3421
+ content: {
3422
+ "application/json": {
3423
+ schema: { $ref: "#/components/schemas/ProfileConfigAddedResponse" }
3424
+ }
3425
+ }
3426
+ }
3427
+ }
3428
+ }
3429
+ },
3430
+ "/v1/profiles/{id}/configs/{configId}": {
3431
+ delete: {
3432
+ operationId: "removeConfigFromProfile",
3433
+ summary: "Remove a config from a profile",
3434
+ description: "Requires an API key with the `instructions:write` scope.",
3435
+ security: [{ apiKey: [] }],
3436
+ parameters: [
3437
+ { name: "id", in: "path", required: true, schema: { type: "string" } },
3438
+ { name: "configId", in: "path", required: true, schema: { type: "string" } }
3439
+ ],
3440
+ responses: {
3441
+ "200": {
3442
+ content: {
3443
+ "application/json": {
3444
+ schema: { $ref: "#/components/schemas/ProfileConfigRemovedResponse" }
3445
+ }
3446
+ }
3447
+ }
3448
+ }
3449
+ }
3450
+ },
3381
3451
  "/v1/stats": {
3382
3452
  get: {
3383
3453
  operationId: "getStats",
@@ -198,6 +198,35 @@ export declare function buildV1OpenApiDocument(version?: string): {
198
198
  };
199
199
  };
200
200
  };
201
+ AddProfileConfigInput: {
202
+ type: string;
203
+ required: string[];
204
+ properties: {
205
+ config_id: {
206
+ type: string;
207
+ };
208
+ };
209
+ };
210
+ ProfileConfigAddedResponse: {
211
+ type: string;
212
+ required: string[];
213
+ properties: {
214
+ added: {
215
+ type: string;
216
+ const: boolean;
217
+ };
218
+ };
219
+ };
220
+ ProfileConfigRemovedResponse: {
221
+ type: string;
222
+ required: string[];
223
+ properties: {
224
+ removed: {
225
+ type: string;
226
+ const: boolean;
227
+ };
228
+ };
229
+ };
201
230
  ProfileWithConfigs: {
202
231
  type: string;
203
232
  properties: {
@@ -777,6 +806,74 @@ export declare function buildV1OpenApiDocument(version?: string): {
777
806
  };
778
807
  };
779
808
  };
809
+ "/v1/profiles/{id}/configs": {
810
+ post: {
811
+ operationId: string;
812
+ summary: string;
813
+ description: string;
814
+ security: {
815
+ apiKey: never[];
816
+ }[];
817
+ parameters: {
818
+ name: string;
819
+ in: string;
820
+ required: boolean;
821
+ schema: {
822
+ type: string;
823
+ };
824
+ }[];
825
+ requestBody: {
826
+ required: boolean;
827
+ content: {
828
+ "application/json": {
829
+ schema: {
830
+ $ref: string;
831
+ };
832
+ };
833
+ };
834
+ };
835
+ responses: {
836
+ "200": {
837
+ content: {
838
+ "application/json": {
839
+ schema: {
840
+ $ref: string;
841
+ };
842
+ };
843
+ };
844
+ };
845
+ };
846
+ };
847
+ };
848
+ "/v1/profiles/{id}/configs/{configId}": {
849
+ delete: {
850
+ operationId: string;
851
+ summary: string;
852
+ description: string;
853
+ security: {
854
+ apiKey: never[];
855
+ }[];
856
+ parameters: {
857
+ name: string;
858
+ in: string;
859
+ required: boolean;
860
+ schema: {
861
+ type: string;
862
+ };
863
+ }[];
864
+ responses: {
865
+ "200": {
866
+ content: {
867
+ "application/json": {
868
+ schema: {
869
+ $ref: string;
870
+ };
871
+ };
872
+ };
873
+ };
874
+ };
875
+ };
876
+ };
780
877
  "/v1/stats": {
781
878
  get: {
782
879
  operationId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmXnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/instructions",
3
- "version": "0.4.26",
3
+ "version": "0.4.28",
4
4
  "description": "AI coding agent instruction & configuration manager \u2014 store, version, apply, and share all your AI coding configs. CLI + MCP + HTTP API (instructions-serve) + generated SDK + Dashboard.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",