@on-par/contracts 0.0.0-stage → 0.9.0

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.
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ /** `INT-<DIMENSION>-<NN>`, e.g. INT-PROBLEM-01. Ordinals widen past 99 rather than wrapping. */
3
+ export declare const INTENT_STATEMENT_ID_PATTERN: RegExp;
4
+ export declare const IntentStatementIdSchema: z.ZodString;
5
+ /** Every intent statement ID a downstream artifact traces to. */
6
+ export declare const TracesToSchema: z.ZodArray<z.ZodString>;
7
+ export type IntentStatementId = z.infer<typeof IntentStatementIdSchema>;
8
+ /** Structural shape of anything that cites intent — Story, Epic, or a future design artifact. */
9
+ export interface Traceable {
10
+ readonly tracesTo?: readonly IntentStatementId[];
11
+ }
12
+ /**
13
+ * Mint an ID. The grammar lives with the validator so minting and checking can never drift:
14
+ * the dimension is upper-cased with non-letters stripped (`nonGoals` -> `NONGOALS`) and the
15
+ * ordinal is 1-based, zero-padded to two digits.
16
+ */
17
+ export declare function formatIntentStatementId(dimension: string, ordinal: number): IntentStatementId;
18
+ export declare function isIntentStatementId(value: unknown): value is IntentStatementId;
19
+ //# sourceMappingURL=trace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gGAAgG;AAChG,eAAO,MAAM,2BAA2B,QAAwB,CAAC;AAEjE,eAAO,MAAM,uBAAuB,aAAiF,CAAC;AAEtH,iEAAiE;AACjE,eAAO,MAAM,cAAc,yBAAmC,CAAC;AAE/D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,iGAAiG;AACjG,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAG7F;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAE9E"}
package/dist/trace.js ADDED
@@ -0,0 +1,20 @@
1
+ // src/trace.ts — Intent-statement IDs: the traceability seam downstream artifacts cite (#471).
2
+ import { z } from 'zod';
3
+ /** `INT-<DIMENSION>-<NN>`, e.g. INT-PROBLEM-01. Ordinals widen past 99 rather than wrapping. */
4
+ export const INTENT_STATEMENT_ID_PATTERN = /^INT-[A-Z]+-\d{2,}$/;
5
+ export const IntentStatementIdSchema = z.string().regex(INTENT_STATEMENT_ID_PATTERN, 'must look like INT-PROBLEM-01');
6
+ /** Every intent statement ID a downstream artifact traces to. */
7
+ export const TracesToSchema = z.array(IntentStatementIdSchema);
8
+ /**
9
+ * Mint an ID. The grammar lives with the validator so minting and checking can never drift:
10
+ * the dimension is upper-cased with non-letters stripped (`nonGoals` -> `NONGOALS`) and the
11
+ * ordinal is 1-based, zero-padded to two digits.
12
+ */
13
+ export function formatIntentStatementId(dimension, ordinal) {
14
+ const slug = dimension.toUpperCase().replace(/[^A-Z]/g, '');
15
+ return `INT-${slug}-${String(Math.max(1, Math.trunc(ordinal))).padStart(2, '0')}`;
16
+ }
17
+ export function isIntentStatementId(value) {
18
+ return typeof value === 'string' && INTENT_STATEMENT_ID_PATTERN.test(value);
19
+ }
20
+ //# sourceMappingURL=trace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace.js","sourceRoot":"","sources":["../src/trace.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gGAAgG;AAChG,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAEjE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,2BAA2B,EAAE,+BAA+B,CAAC,CAAC;AAEtH,iEAAiE;AACjE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC,CAAC;AAS/D;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,SAAiB,EAAE,OAAe;IACxE,MAAM,IAAI,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IAC5D,OAAO,OAAO,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;AACpF,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,2BAA2B,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@on-par/contracts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.9.0",
4
+ "description": "Shared typed seam: engineering-ready issue/epic/story, Gherkin acceptance criteria, and the DesignArtifact schema.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "development": "./src/index.ts",
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "!dist/.tsbuildinfo"
18
+ ],
19
+ "publishConfig": {
20
+ "access": "public"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/on-par/software-factory.git",
25
+ "directory": "packages/contracts"
26
+ },
27
+ "homepage": "https://github.com/on-par/software-factory#readme",
28
+ "bugs": {
29
+ "url": "https://github.com/on-par/software-factory/issues"
30
+ },
31
+ "engines": {
32
+ "node": ">=24.0.0"
33
+ },
34
+ "scripts": {
35
+ "build": "tsc -p tsconfig.build.json",
36
+ "typecheck": "tsc --noEmit -p tsconfig.json",
37
+ "test": "vitest run",
38
+ "prepublishOnly": "npm run build",
39
+ "prepack": "node ../../scripts/pack-hygiene-cli.ts prepack"
40
+ },
41
+ "dependencies": {
42
+ "zod": "^4.6.5"
43
+ },
44
+ "license": "MIT",
45
+ "devDependencies": {
46
+ "@types/node": "^26.6.4"
47
+ }
48
+ }