@latysh-development/monolith 0.1.0-alpha.1 → 0.1.0-alpha.3
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/README.md +24 -1
- package/dist/brief/collect.d.ts.map +1 -1
- package/dist/brief/collect.js +6 -2
- package/dist/brief/freshness.d.ts +33 -5
- package/dist/brief/freshness.d.ts.map +1 -1
- package/dist/brief/freshness.js +67 -13
- package/dist/brief/markdown-context.d.ts +22 -0
- package/dist/brief/markdown-context.d.ts.map +1 -0
- package/dist/brief/markdown-context.js +66 -0
- package/dist/brief/story.d.ts +2 -10
- package/dist/brief/story.d.ts.map +1 -1
- package/dist/brief/story.js +21 -7
- package/dist/cli/index.js +12 -0
- package/dist/finalize/cli.d.ts +10 -0
- package/dist/finalize/cli.d.ts.map +1 -0
- package/dist/finalize/cli.js +134 -0
- package/dist/finalize/core.d.ts +110 -0
- package/dist/finalize/core.d.ts.map +1 -0
- package/dist/finalize/core.js +773 -0
- package/dist/finalize/index.d.ts +5 -0
- package/dist/finalize/index.d.ts.map +1 -0
- package/dist/finalize/index.js +2 -0
- package/dist/finalize/proposal.d.ts +97 -0
- package/dist/finalize/proposal.d.ts.map +1 -0
- package/dist/finalize/proposal.js +213 -0
- package/dist/ui/apple-touch-icon.png +0 -0
- package/dist/ui/assets/index-5zXAgig8.css +1 -0
- package/dist/ui/assets/{index-C4NhMaq7.js → index-CQgoMYLM.js} +5 -5
- package/dist/ui/assets/monolith-mark-Ct0ammrU.webp +0 -0
- package/dist/ui/favicon-16x16.png +0 -0
- package/dist/ui/favicon-32x32.png +0 -0
- package/dist/ui/favicon.ico +0 -0
- package/dist/ui/index.html +6 -2
- package/dist/update/cli.d.ts +1 -1
- package/dist/update/cli.d.ts.map +1 -1
- package/dist/update/cli.js +10 -3
- package/dist/update/index.d.ts +9 -0
- package/dist/update/index.d.ts.map +1 -1
- package/dist/update/index.js +50 -1
- package/dist/update/legacy-skills.d.ts +15 -0
- package/dist/update/legacy-skills.d.ts.map +1 -0
- package/dist/update/legacy-skills.js +20 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/templates/default-instance/monolith/context/MONOLITH-CHAT-CONTEXT.md +183 -0
- package/templates/default-instance/monolith/memory/working/active.md +11 -0
- package/templates/default-instance/monolith/skills/finalize-story/SKILL.md +68 -2
- package/dist/ui/assets/index-DMZ7ZvZY.css +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { parseProposal, validateRelPath, PROPOSAL_SCHEMA_VERSION } from './proposal.js';
|
|
2
|
+
export type { FinalizationProposal, ProposalParse, ExpectedCurrentStory } from './proposal.js';
|
|
3
|
+
export { planFinalization, applyFinalization, readFinalizeConfig, renderCapsule } from './core.js';
|
|
4
|
+
export type { ApplyResult, ApplyStatus, Check, CheckStatus, FinalizationPlan, FinalizeConfig, FinalizeOptions, PlanStatus, PlannedTarget, TargetKind, TargetState, } from './core.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/finalize/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxF,YAAY,EAAE,oBAAoB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACnG,YAAY,EACV,WAAW,EACX,WAAW,EACX,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,UAAU,EACV,WAAW,GACZ,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finalization proposal (DOCSYNC-001): the typed, strictly validated input an
|
|
3
|
+
* AI assistant or developer prepares. It carries the *content* of the
|
|
4
|
+
* finalization; MONOLITH decides whether and where it may be applied.
|
|
5
|
+
*
|
|
6
|
+
* Validation is structural and syntactic only. Whether the content is *true*
|
|
7
|
+
* (the summary matches the code) is the owner's judgement, taken when they
|
|
8
|
+
* approve the plan digest — never something this module claims to check.
|
|
9
|
+
*/
|
|
10
|
+
export declare const PROPOSAL_SCHEMA_VERSION = 1;
|
|
11
|
+
/**
|
|
12
|
+
* What the Current Story section of active.md must hold before the transition.
|
|
13
|
+
* There is deliberately no "any": a proposal cannot switch the guard off and
|
|
14
|
+
* silently replace somebody else's active story. `contains` must name the
|
|
15
|
+
* story being finalized (checked in `parseProposal`).
|
|
16
|
+
*/
|
|
17
|
+
export type ExpectedCurrentStory = 'none' | {
|
|
18
|
+
contains: string;
|
|
19
|
+
};
|
|
20
|
+
export interface FinalizationProposal {
|
|
21
|
+
schemaVersion: 1;
|
|
22
|
+
story: {
|
|
23
|
+
/** Story identifier, e.g. `DOCSYNC-001` or `1.3`. Used as the idempotency key. */
|
|
24
|
+
id: string;
|
|
25
|
+
title: string;
|
|
26
|
+
/** Phase directory name under `memory/working/phases/`, e.g. `phase-1`. */
|
|
27
|
+
phase: string;
|
|
28
|
+
/** Text of the `## ` heading in story-index.md the entry belongs to. */
|
|
29
|
+
phaseHeading: string;
|
|
30
|
+
/** Capsule file base name (without `.md`), e.g. `story-docsync-001-finalization`. */
|
|
31
|
+
slug: string;
|
|
32
|
+
/** `YYYY-MM-DD`. Supplied by the caller: MONOLITH never invents a finalization date. */
|
|
33
|
+
date: string;
|
|
34
|
+
};
|
|
35
|
+
/** What the Current Story section of active.md must look like before the transition. */
|
|
36
|
+
expectedCurrentStory: ExpectedCurrentStory;
|
|
37
|
+
work: {
|
|
38
|
+
objective: string;
|
|
39
|
+
implementationSummary: string;
|
|
40
|
+
filesChanged: string[];
|
|
41
|
+
tests: string;
|
|
42
|
+
keyDecisions: string;
|
|
43
|
+
adrs: string[];
|
|
44
|
+
lessons: string;
|
|
45
|
+
};
|
|
46
|
+
/** One-paragraph summary for story-index.md. */
|
|
47
|
+
summary: string;
|
|
48
|
+
keyOutputs: string[];
|
|
49
|
+
history: {
|
|
50
|
+
phaseName: string;
|
|
51
|
+
decision: string;
|
|
52
|
+
build: string;
|
|
53
|
+
};
|
|
54
|
+
/** Complete replacement of HANDOFF.md. Optional: omitted means HANDOFF.md is not touched. */
|
|
55
|
+
handoff?: {
|
|
56
|
+
content: string;
|
|
57
|
+
};
|
|
58
|
+
/** Extra documentation edits; each path must be allowed by `monolith.config.json` `finalization`. */
|
|
59
|
+
docUpdates?: Array<{
|
|
60
|
+
path: string;
|
|
61
|
+
newContent: string;
|
|
62
|
+
reason: string;
|
|
63
|
+
}>;
|
|
64
|
+
}
|
|
65
|
+
export type ProposalParse = {
|
|
66
|
+
ok: true;
|
|
67
|
+
proposal: FinalizationProposal;
|
|
68
|
+
} | {
|
|
69
|
+
ok: false;
|
|
70
|
+
errors: string[];
|
|
71
|
+
};
|
|
72
|
+
export declare const LIMITS: {
|
|
73
|
+
readonly idLen: 64;
|
|
74
|
+
readonly titleLen: 200;
|
|
75
|
+
readonly lineLen: 1000;
|
|
76
|
+
readonly blockLen: 20000;
|
|
77
|
+
readonly listItems: 200;
|
|
78
|
+
readonly docUpdates: 20;
|
|
79
|
+
readonly docBytes: number;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* True when `text` holds `id` as a whole Story ID token (case-insensitive).
|
|
83
|
+
* Tokens are maximal runs of the Story ID alphabet [A-Za-z0-9._-]; trailing
|
|
84
|
+
* `.`/`_`/`-` (sentence punctuation) are dropped. So `S-1` is a token of
|
|
85
|
+
* "S-1 in progress" or "(S-1)", but never of "S-10", "XS-1", "1.10" or "11.1".
|
|
86
|
+
*/
|
|
87
|
+
export declare function hasStoryIdToken(text: string, id: string): boolean;
|
|
88
|
+
export declare function validDate(s: string): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* Lexical validation of a project-relative document path (R4). Rejects
|
|
91
|
+
* absolute paths, `..`, backslashes, NUL, empty segments and VCS internals.
|
|
92
|
+
* Symlinks are NOT decided here: they are refused by the safe read/write
|
|
93
|
+
* primitives, which look at the real file system.
|
|
94
|
+
*/
|
|
95
|
+
export declare function validateRelPath(p: unknown): string | null;
|
|
96
|
+
export declare function parseProposal(raw: unknown): ProposalParse;
|
|
97
|
+
//# sourceMappingURL=proposal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposal.d.ts","sourceRoot":"","sources":["../../src/finalize/proposal.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,MAAM,WAAW,oBAAoB;IACnC,aAAa,EAAE,CAAC,CAAC;IACjB,KAAK,EAAE;QACL,kFAAkF;QAClF,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,2EAA2E;QAC3E,KAAK,EAAE,MAAM,CAAC;QACd,wEAAwE;QACxE,YAAY,EAAE,MAAM,CAAC;QACrB,qFAAqF;QACrF,IAAI,EAAE,MAAM,CAAC;QACb,wFAAwF;QACxF,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,wFAAwF;IACxF,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;QAClB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,EAAE,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAChE,6FAA6F;IAC7F,OAAO,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9B,qGAAqG;IACrG,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC1E;AAED,MAAM,MAAM,aAAa,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,oBAAoB,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE3G,eAAO,MAAM,MAAM;;;;;;;;CAQT,CAAC;AAIX;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAGjE;AAaD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAK5C;AAuBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAUzD;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CA2GzD"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Finalization proposal (DOCSYNC-001): the typed, strictly validated input an
|
|
3
|
+
* AI assistant or developer prepares. It carries the *content* of the
|
|
4
|
+
* finalization; MONOLITH decides whether and where it may be applied.
|
|
5
|
+
*
|
|
6
|
+
* Validation is structural and syntactic only. Whether the content is *true*
|
|
7
|
+
* (the summary matches the code) is the owner's judgement, taken when they
|
|
8
|
+
* approve the plan digest — never something this module claims to check.
|
|
9
|
+
*/
|
|
10
|
+
export const PROPOSAL_SCHEMA_VERSION = 1;
|
|
11
|
+
export const LIMITS = {
|
|
12
|
+
idLen: 64,
|
|
13
|
+
titleLen: 200,
|
|
14
|
+
lineLen: 1000,
|
|
15
|
+
blockLen: 20000,
|
|
16
|
+
listItems: 200,
|
|
17
|
+
docUpdates: 20,
|
|
18
|
+
docBytes: 1024 * 1024,
|
|
19
|
+
};
|
|
20
|
+
const ID_RE = /^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/;
|
|
21
|
+
/**
|
|
22
|
+
* True when `text` holds `id` as a whole Story ID token (case-insensitive).
|
|
23
|
+
* Tokens are maximal runs of the Story ID alphabet [A-Za-z0-9._-]; trailing
|
|
24
|
+
* `.`/`_`/`-` (sentence punctuation) are dropped. So `S-1` is a token of
|
|
25
|
+
* "S-1 in progress" or "(S-1)", but never of "S-10", "XS-1", "1.10" or "11.1".
|
|
26
|
+
*/
|
|
27
|
+
export function hasStoryIdToken(text, id) {
|
|
28
|
+
const want = id.toLowerCase();
|
|
29
|
+
return (text.match(/[A-Za-z0-9._-]+/g) ?? []).some((t) => t.replace(/[._-]+$/, '').toLowerCase() === want);
|
|
30
|
+
}
|
|
31
|
+
const SLUG_RE = /^[a-z0-9][a-z0-9._-]{0,99}$/;
|
|
32
|
+
const PHASE_RE = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
33
|
+
const DATE_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
34
|
+
function isObject(v) {
|
|
35
|
+
return typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
36
|
+
}
|
|
37
|
+
function noUnknown(obj, allowed, where, errors) {
|
|
38
|
+
for (const k of Object.keys(obj))
|
|
39
|
+
if (!allowed.includes(k))
|
|
40
|
+
errors.push(`${where}: unknown field "${k}".`);
|
|
41
|
+
}
|
|
42
|
+
export function validDate(s) {
|
|
43
|
+
const m = DATE_RE.exec(s);
|
|
44
|
+
if (m === null)
|
|
45
|
+
return false;
|
|
46
|
+
const d = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])));
|
|
47
|
+
return d.getUTCFullYear() === Number(m[1]) && d.getUTCMonth() === Number(m[2]) - 1 && d.getUTCDate() === Number(m[3]);
|
|
48
|
+
}
|
|
49
|
+
function text(v, where, errors, opts) {
|
|
50
|
+
if (typeof v !== 'string') {
|
|
51
|
+
errors.push(`${where}: must be a string.`);
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
if (v.includes('\0'))
|
|
55
|
+
errors.push(`${where}: must not contain NUL.`);
|
|
56
|
+
if (!opts.allowEmpty && v.trim().length === 0)
|
|
57
|
+
errors.push(`${where}: must not be empty.`);
|
|
58
|
+
if (v.length > opts.max)
|
|
59
|
+
errors.push(`${where}: longer than ${opts.max} characters.`);
|
|
60
|
+
if (!opts.multiline && /[\r\n\u2028\u2029]/.test(v))
|
|
61
|
+
errors.push(`${where}: must be a single line.`);
|
|
62
|
+
return v;
|
|
63
|
+
}
|
|
64
|
+
function lines(v, where, errors) {
|
|
65
|
+
if (!Array.isArray(v)) {
|
|
66
|
+
errors.push(`${where}: must be an array of strings.`);
|
|
67
|
+
return [];
|
|
68
|
+
}
|
|
69
|
+
if (v.length > LIMITS.listItems)
|
|
70
|
+
errors.push(`${where}: more than ${LIMITS.listItems} items.`);
|
|
71
|
+
return v.map((x, i) => text(x, `${where}[${i}]`, errors, { multiline: false, max: LIMITS.lineLen }));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Lexical validation of a project-relative document path (R4). Rejects
|
|
75
|
+
* absolute paths, `..`, backslashes, NUL, empty segments and VCS internals.
|
|
76
|
+
* Symlinks are NOT decided here: they are refused by the safe read/write
|
|
77
|
+
* primitives, which look at the real file system.
|
|
78
|
+
*/
|
|
79
|
+
export function validateRelPath(p) {
|
|
80
|
+
if (typeof p !== 'string' || p.length === 0 || p.length > 260)
|
|
81
|
+
return 'path must be a non-empty string of at most 260 characters';
|
|
82
|
+
if (p.includes('\0') || p.includes('\\'))
|
|
83
|
+
return 'path must not contain NUL or backslashes';
|
|
84
|
+
if (p.startsWith('/') || /^[A-Za-z]:/.test(p))
|
|
85
|
+
return 'path must be relative to the project root';
|
|
86
|
+
const segs = p.split('/');
|
|
87
|
+
if (segs.some((s) => s === '' || s === '.' || s === '..'))
|
|
88
|
+
return 'path must not contain empty, "." or ".." segments';
|
|
89
|
+
// `.git` at ANY depth (nested repositories, submodule checkouts), any case
|
|
90
|
+
// (case-insensitive file systems), and trailing dot/space (Windows aliases).
|
|
91
|
+
if (segs.some((s) => /^\.git[. ]*$/i.test(s)) || segs.includes('node_modules'))
|
|
92
|
+
return 'path must not contain a .git (any case, any depth) or node_modules component';
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
export function parseProposal(raw) {
|
|
96
|
+
const errors = [];
|
|
97
|
+
if (!isObject(raw))
|
|
98
|
+
return { ok: false, errors: ['proposal must be a JSON object.'] };
|
|
99
|
+
noUnknown(raw, ['schemaVersion', 'story', 'expectedCurrentStory', 'work', 'summary', 'keyOutputs', 'history', 'handoff', 'docUpdates'], 'proposal', errors);
|
|
100
|
+
if (raw.schemaVersion !== PROPOSAL_SCHEMA_VERSION)
|
|
101
|
+
errors.push(`schemaVersion: must be ${PROPOSAL_SCHEMA_VERSION}.`);
|
|
102
|
+
const story = isObject(raw.story) ? raw.story : (errors.push('story: must be an object.'), {});
|
|
103
|
+
noUnknown(story, ['id', 'title', 'phase', 'phaseHeading', 'slug', 'date'], 'story', errors);
|
|
104
|
+
const id = text(story.id, 'story.id', errors, { multiline: false, max: LIMITS.idLen });
|
|
105
|
+
if (id && !ID_RE.test(id))
|
|
106
|
+
errors.push('story.id: must match [A-Za-z0-9][A-Za-z0-9._-]{0,63}.');
|
|
107
|
+
const title = text(story.title, 'story.title', errors, { multiline: false, max: LIMITS.titleLen });
|
|
108
|
+
const phase = text(story.phase, 'story.phase', errors, { multiline: false, max: 32 });
|
|
109
|
+
if (phase && !PHASE_RE.test(phase))
|
|
110
|
+
errors.push('story.phase: must match [a-z0-9][a-z0-9-]{0,31}.');
|
|
111
|
+
const phaseHeading = text(story.phaseHeading, 'story.phaseHeading', errors, { multiline: false, max: LIMITS.titleLen });
|
|
112
|
+
if (phaseHeading.startsWith('#'))
|
|
113
|
+
errors.push('story.phaseHeading: give the heading text without leading "#".');
|
|
114
|
+
const slug = text(story.slug, 'story.slug', errors, { multiline: false, max: 100 });
|
|
115
|
+
if (slug && !SLUG_RE.test(slug))
|
|
116
|
+
errors.push('story.slug: must match [a-z0-9][a-z0-9._-]{0,99}.');
|
|
117
|
+
const date = text(story.date, 'story.date', errors, { multiline: false, max: 10 });
|
|
118
|
+
if (date && !validDate(date))
|
|
119
|
+
errors.push('story.date: must be a real date YYYY-MM-DD.');
|
|
120
|
+
let expected = 'none';
|
|
121
|
+
const e = raw.expectedCurrentStory;
|
|
122
|
+
if (e === 'none')
|
|
123
|
+
expected = e;
|
|
124
|
+
else if (isObject(e) && typeof e.contains === 'string' && e.contains.trim() !== '' && Object.keys(e).length === 1 && e.contains.length <= LIMITS.lineLen) {
|
|
125
|
+
expected = { contains: e.contains };
|
|
126
|
+
if (id && !hasStoryIdToken(e.contains, id)) {
|
|
127
|
+
errors.push(`expectedCurrentStory.contains: must contain the story id "${id}" as a whole token (not as part of a longer id), so the guard cannot match another story.`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
else if (e === 'any') {
|
|
131
|
+
errors.push('expectedCurrentStory: "any" is not accepted (it would allow replacing an unrelated active story). Use "none" or {"contains": "<text containing the story id>"}.');
|
|
132
|
+
}
|
|
133
|
+
else
|
|
134
|
+
errors.push('expectedCurrentStory: must be "none" or {"contains": "<text containing the story id>"}.');
|
|
135
|
+
const w = isObject(raw.work) ? raw.work : (errors.push('work: must be an object.'), {});
|
|
136
|
+
noUnknown(w, ['objective', 'implementationSummary', 'filesChanged', 'tests', 'keyDecisions', 'adrs', 'lessons'], 'work', errors);
|
|
137
|
+
const block = (v, name) => text(v, `work.${name}`, errors, { multiline: true, max: LIMITS.blockLen });
|
|
138
|
+
const work = {
|
|
139
|
+
objective: block(w.objective, 'objective'),
|
|
140
|
+
implementationSummary: block(w.implementationSummary, 'implementationSummary'),
|
|
141
|
+
filesChanged: lines(w.filesChanged, 'work.filesChanged', errors),
|
|
142
|
+
tests: block(w.tests, 'tests'),
|
|
143
|
+
keyDecisions: block(w.keyDecisions, 'keyDecisions'),
|
|
144
|
+
adrs: lines(w.adrs, 'work.adrs', errors),
|
|
145
|
+
lessons: block(w.lessons, 'lessons'),
|
|
146
|
+
};
|
|
147
|
+
const summary = text(raw.summary, 'summary', errors, { multiline: false, max: LIMITS.blockLen });
|
|
148
|
+
const keyOutputs = lines(raw.keyOutputs, 'keyOutputs', errors);
|
|
149
|
+
const h = isObject(raw.history) ? raw.history : (errors.push('history: must be an object.'), {});
|
|
150
|
+
noUnknown(h, ['phaseName', 'decision', 'build'], 'history', errors);
|
|
151
|
+
const history = {
|
|
152
|
+
phaseName: text(h.phaseName, 'history.phaseName', errors, { multiline: false, max: LIMITS.titleLen }),
|
|
153
|
+
decision: text(h.decision, 'history.decision', errors, { multiline: false, max: LIMITS.blockLen }),
|
|
154
|
+
build: text(h.build, 'history.build', errors, { multiline: false, max: LIMITS.lineLen }),
|
|
155
|
+
};
|
|
156
|
+
let handoff;
|
|
157
|
+
if (raw.handoff !== undefined) {
|
|
158
|
+
if (!isObject(raw.handoff))
|
|
159
|
+
errors.push('handoff: must be an object {"content": "..."}.');
|
|
160
|
+
else {
|
|
161
|
+
noUnknown(raw.handoff, ['content'], 'handoff', errors);
|
|
162
|
+
const content = text(raw.handoff.content, 'handoff.content', errors, { multiline: true, max: LIMITS.docBytes });
|
|
163
|
+
handoff = { content };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
let docUpdates;
|
|
167
|
+
if (raw.docUpdates !== undefined) {
|
|
168
|
+
if (!Array.isArray(raw.docUpdates))
|
|
169
|
+
errors.push('docUpdates: must be an array.');
|
|
170
|
+
else {
|
|
171
|
+
if (raw.docUpdates.length > LIMITS.docUpdates)
|
|
172
|
+
errors.push(`docUpdates: more than ${LIMITS.docUpdates} entries.`);
|
|
173
|
+
docUpdates = [];
|
|
174
|
+
const seen = new Set();
|
|
175
|
+
raw.docUpdates.forEach((d, i) => {
|
|
176
|
+
const where = `docUpdates[${i}]`;
|
|
177
|
+
if (!isObject(d)) {
|
|
178
|
+
errors.push(`${where}: must be an object.`);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
noUnknown(d, ['path', 'newContent', 'reason'], where, errors);
|
|
182
|
+
const bad = validateRelPath(d.path);
|
|
183
|
+
if (bad !== null)
|
|
184
|
+
errors.push(`${where}.path: ${bad}.`);
|
|
185
|
+
const path = typeof d.path === 'string' ? d.path : '';
|
|
186
|
+
if (seen.has(path))
|
|
187
|
+
errors.push(`${where}.path: "${path}" is listed twice.`);
|
|
188
|
+
seen.add(path);
|
|
189
|
+
docUpdates.push({
|
|
190
|
+
path,
|
|
191
|
+
newContent: text(d.newContent, `${where}.newContent`, errors, { multiline: true, max: LIMITS.docBytes }),
|
|
192
|
+
reason: text(d.reason, `${where}.reason`, errors, { multiline: false, max: LIMITS.lineLen }),
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (errors.length > 0)
|
|
198
|
+
return { ok: false, errors };
|
|
199
|
+
const proposal = {
|
|
200
|
+
schemaVersion: 1,
|
|
201
|
+
story: { id, title, phase, phaseHeading, slug, date },
|
|
202
|
+
expectedCurrentStory: expected,
|
|
203
|
+
work,
|
|
204
|
+
summary,
|
|
205
|
+
keyOutputs,
|
|
206
|
+
history,
|
|
207
|
+
};
|
|
208
|
+
if (handoff)
|
|
209
|
+
proposal.handoff = handoff;
|
|
210
|
+
if (docUpdates && docUpdates.length > 0)
|
|
211
|
+
proposal.docUpdates = docUpdates;
|
|
212
|
+
return { ok: true, proposal };
|
|
213
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.skin-switcher[data-v-570e4117]{color:var(--muted);font-size:var(--fs-secondary);display:flex;flex-direction:column;gap:4px}.skin-switcher select[data-v-570e4117]{background:var(--surface-2);color:var(--text);border:1px solid var(--control-border);border-radius:4px;padding:4px 6px;font:inherit}:root{--bg: #0e1116;--surface: #161b22;--surface-2: #1d242d;--border: #2b3440;--control-border: #627185;--text: #e6edf3;--muted: #a3afc0;--accent: #58a6ff;--ok: #3fb950;--warn: #d29922;--err: #f85149;--demo: #f0b429;color-scheme:dark;--fs-body: 16px;--fs-nav: 15px;--fs-project: 18px;--fs-h2: 16px;--fs-h3: 15px;--fs-secondary: 14px;--fs-meta: 13px;--fs-label: 12px;--fs-mono: 14px;--lh-body: 1.55;--lh-heading: 1.3}*{box-sizing:border-box}html{scrollbar-gutter:stable}body{margin:0;background:var(--bg);color:var(--text);font:var(--fs-body)/var(--lh-body) system-ui,-apple-system,"Segoe UI",Roboto,sans-serif}code,pre{font-family:ui-monospace,SF Mono,Menlo,Consolas,monospace;font-size:var(--fs-mono);line-height:1.55}.shell{display:flex;align-items:flex-start;min-height:100vh}.shell-main{flex:1 1 auto;min-width:0}.sidebar{position:sticky;top:0;align-self:flex-start;flex:0 0 240px;width:240px;height:100vh;display:flex;flex-direction:column;background:var(--surface);border-right:1px solid var(--border)}.sidebar-head{padding:14px 16px}.sidebar-panel{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:16px;padding:4px 12px 16px;overflow-y:auto}.sidebar-panel .skin-switcher{padding:0 4px 12px;border-bottom:1px solid var(--border)}.nav-toggle{display:none}.topbar{display:flex;flex-wrap:wrap;align-items:center;gap:12px 24px;padding:10px 20px;min-height:52px;background:var(--surface);border-bottom:1px solid var(--border)}.brand{display:flex;gap:10px;align-items:center;min-width:0}.brand-logo{flex:none;width:40px;height:40px;display:block}.brand-text{display:flex;flex-direction:column;min-width:0;line-height:1.25}.brand .muted{white-space:nowrap;font-size:var(--fs-meta)}.brand strong{letter-spacing:.12em;font-size:var(--fs-h2)}.project{font-weight:600;font-size:var(--fs-project);line-height:var(--lh-heading);min-width:0;overflow-wrap:anywhere}.topbar-right{margin-left:auto;display:flex;align-items:center;gap:14px}.scenario{color:var(--muted);font-size:var(--fs-secondary);display:flex;gap:6px;align-items:center}.scenario select{background:var(--surface-2);color:var(--text);border:1px solid var(--control-border);border-radius:4px;padding:4px 8px;font:inherit;min-height:32px}.demo-badge{background:var(--demo);color:#1a1300;font-weight:800;letter-spacing:.1em;padding:4px 12px;border-radius:4px}.nav{display:flex;flex-direction:column;gap:2px}.nav a{color:var(--muted);text-decoration:none;overflow-wrap:anywhere;padding:8px 12px;border-radius:4px;font-size:var(--fs-nav);line-height:1.35}.nav a:hover{color:var(--text);background:var(--surface-2)}.nav a[aria-current=location]{color:var(--text);background:var(--surface-2);font-weight:600;box-shadow:inset 3px 0 0 var(--accent)}.nav a:focus-visible,button:focus-visible,select:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.content{max-width:1100px;margin:0 auto;padding:20px;display:grid;grid-template-columns:minmax(0,1fr);gap:16px}.panel{min-width:0;overflow-wrap:anywhere;background:var(--surface);border:1px solid var(--border);border-radius:6px;padding:16px 20px;scroll-margin-top:16px}.panel h2{margin:0 0 12px;font-size:var(--fs-h2);line-height:var(--lh-heading);text-transform:uppercase;letter-spacing:.06em;color:var(--accent)}.panel h3{margin:16px 0 6px;font-size:var(--fs-h3);line-height:var(--lh-heading)}.panel h4{margin:10px 0 4px;font-size:var(--fs-secondary);line-height:var(--lh-heading);color:var(--muted)}.facts{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:4px 16px;margin:0}.facts dt{color:var(--muted)}.facts dt,.facts dd{min-width:0}.facts dd{margin:0;overflow-wrap:anywhere}.facts.compact{font-size:var(--fs-secondary);margin-top:8px}.cards{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:minmax(0,1fr);gap:10px}.card{min-width:0;overflow-wrap:anywhere;background:var(--surface-2);border:1px solid var(--border);border-radius:4px;padding:10px 14px}.card h3{margin:6px 0 2px;font-size:var(--fs-h3);line-height:var(--lh-heading)}.card p{margin:4px 0}.card-head{display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap}.status{font-size:var(--fs-meta);padding:1px 8px;border-radius:10px;border:1px solid var(--ok);color:var(--ok)}.steps ul{margin:0;padding-left:20px}.tag{font-weight:400;font-size:var(--fs-label);color:var(--warn);border:1px solid var(--warn);border-radius:3px;padding:0 6px;margin-left:6px}.roadmap{margin:0;padding:12px;background:var(--surface-2);border-radius:4px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:var(--fs-mono);line-height:1.55}.diag li{min-width:0}.diag{list-style:none;margin:0;padding:0;display:grid;gap:4px}.sev{font-size:var(--fs-label);text-transform:uppercase;font-weight:700;margin-right:6px}.sev-info .sev{color:var(--accent)}.sev-warning .sev{color:var(--warn)}.sev-error .sev{color:var(--err)}.muted{color:var(--muted)}.empty{color:var(--muted);font-style:italic;margin:0}.unknown{color:var(--warn);font-weight:600;font-style:normal;letter-spacing:.04em}@media(max-width:899px){.shell{display:block}.sidebar{position:sticky;top:0;z-index:2;width:auto;height:auto;max-height:100vh;border-right:0;border-bottom:1px solid var(--border)}.sidebar-head{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 12px}.brand-logo{width:36px;height:36px}.sidebar-panel{display:none;padding-top:4px;max-height:calc(100vh - 56px)}.sidebar.open .sidebar-panel{display:flex}.nav-toggle{display:inline-block}.panel{scroll-margin-top:64px}}@media(max-width:600px){.topbar{padding-left:12px;padding-right:12px}.topbar-right{margin-left:0;width:100%;flex-wrap:wrap;justify-content:space-between}.content{padding:12px}.facts{grid-template-columns:1fr}.facts dd{margin-bottom:6px}}.live-badge{background:#1f6f43;color:#eafff3;font-weight:800;letter-spacing:.1em;padding:4px 12px;border-radius:4px}.live-badge-off{background:var(--surface-2);color:var(--muted, #9aa4b2);border:1px solid var(--border)}.story{white-space:pre-wrap;margin:0;font:inherit}button{background:var(--surface-2);color:var(--text);border:1px solid var(--control-border);border-radius:4px;padding:4px 12px;font:inherit;cursor:pointer}button:disabled{opacity:.5;cursor:default}.section-fade-enter-active{transition:opacity .22s ease-out,transform .22s ease-out}.section-fade-leave-active{transition:opacity .15s ease-in,transform .15s ease-in}.section-fade-enter-from{opacity:0;transform:translateY(8px)}.section-fade-leave-to{opacity:0;transform:translateY(-8px)}@media(prefers-reduced-motion:reduce){.section-fade-enter-active,.section-fade-leave-active{transition:none}.section-fade-enter-from,.section-fade-leave-to{opacity:1;transform:none}}:root[data-skin=cosmic-glass]{--bg: #080a1e;--surface: rgba(12, 16, 40, .74);--surface-2: rgba(30, 34, 76, .62);--border: rgba(190, 200, 255, .2);--control-border: rgba(204, 212, 255, .52);--text: #f1f4ff;--muted: #c6d0e8;--accent: #b4a9ff;--ok: #5fd68a;--warn: #f0c040;--err: #ff8a85;--demo: #f0b429;--glass-dense: rgba(9, 12, 32, .86);--glass-edge: inset 0 1px 0 rgba(255, 255, 255, .07);--glass-shadow: 0 8px 32px rgba(2, 3, 14, .45);--glass-blur: blur(14px) saturate(1.15);background:var(--bg)}:root[data-skin=cosmic-glass] body{background:transparent;isolation:isolate}:root[data-skin=cosmic-glass] body:before{content:"";position:fixed;top:0;bottom:0;right:0;left:-14vw;z-index:-1;pointer-events:none;background:linear-gradient(180deg,#080a1e00,#080a1e33 60%,#080a1e99),url(./cosmic-glass-bg-Dwx47zPu.webp) 24% 0 / cover no-repeat,var(--bg)}:root[data-skin=cosmic-glass] .sidebar{background:#080b2080;-webkit-backdrop-filter:blur(4px) saturate(1.1);backdrop-filter:blur(4px) saturate(1.1);border-right-color:var(--border);box-shadow:1px 0 #968cff14,6px 0 28px #02030e59}:root[data-skin=cosmic-glass] .brand strong{color:var(--text);letter-spacing:.16em}:root[data-skin=cosmic-glass] .brand .muted{font-size:var(--fs-meta)}:root[data-skin=cosmic-glass] .brand-logo{border-radius:9px;box-shadow:0 0 0 1px #bec8ff47,0 2px 12px #02030e80}:root[data-skin=cosmic-glass] .nav a{color:var(--muted);border-left:2px solid transparent;border-radius:0 6px 6px 0}:root[data-skin=cosmic-glass] .nav a:hover{color:var(--text);background:#968cff29;border-left-color:var(--accent)}:root[data-skin=cosmic-glass] .nav a[aria-current=location]{color:var(--text);background:linear-gradient(90deg,#968cff42,#968cff14);border-left-color:#d3ccff;box-shadow:none}:root[data-skin=cosmic-glass] .sidebar-panel .skin-switcher{border-bottom-color:var(--border)}:root[data-skin=cosmic-glass] .topbar{background:#080b20a8;-webkit-backdrop-filter:blur(12px) saturate(1.1);backdrop-filter:blur(12px) saturate(1.1);border-bottom-color:var(--border);box-shadow:0 6px 24px #02030e4d}:root[data-skin=cosmic-glass] .project{font-size:var(--fs-project);letter-spacing:.01em}:root[data-skin=cosmic-glass] .live-badge{background:#14532f;color:#eafff3;border:1px solid #5fd68a}:root[data-skin=cosmic-glass] .live-badge-off{background:var(--glass-dense);color:var(--muted);border-color:var(--border)}:root[data-skin=cosmic-glass] .demo-badge{border:1px solid #ffd978}:root[data-skin=cosmic-glass] .panel{background:var(--surface);-webkit-backdrop-filter:var(--glass-blur);backdrop-filter:var(--glass-blur);border-radius:10px;box-shadow:var(--glass-edge),var(--glass-shadow);padding:18px 22px}:root[data-skin=cosmic-glass] .panel h2{font-size:var(--fs-h2);letter-spacing:.08em;font-weight:700;padding-bottom:8px;margin-bottom:14px;border-bottom:1px solid var(--border)}:root[data-skin=cosmic-glass] .panel h3{font-size:var(--fs-h3);font-weight:650}:root[data-skin=cosmic-glass] .card{background:var(--surface-2);border-radius:8px;box-shadow:var(--glass-edge);line-height:1.55}:root[data-skin=cosmic-glass] .facts dt{font-size:var(--fs-secondary)}:root[data-skin=cosmic-glass] .roadmap,:root[data-skin=cosmic-glass] .story{background:var(--glass-dense);border-radius:8px;line-height:1.6}:root[data-skin=cosmic-glass] .roadmap{border:1px solid var(--border)}:root[data-skin=cosmic-glass] .status{background:#5fd68a1f}:root[data-skin=cosmic-glass] .tag{background:#f0c0401a}:root[data-skin=cosmic-glass] button,:root[data-skin=cosmic-glass] select{background:var(--glass-dense);border-color:var(--control-border)}:root[data-skin=cosmic-glass] button:hover:not(:disabled){border-color:var(--accent);background:#3c3882b3}:root[data-skin=cosmic-glass] button:disabled{opacity:1;color:#8f9abb;border-style:dashed;cursor:not-allowed}:root[data-skin=cosmic-glass] a:focus-visible,:root[data-skin=cosmic-glass] button:focus-visible,:root[data-skin=cosmic-glass] select:focus-visible{outline:2px solid #d3ccff;outline-offset:2px;box-shadow:0 0 0 4px #9a8cff59}@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))){:root[data-skin=cosmic-glass]{--surface: rgba(12, 16, 40, .92);--surface-2: rgba(26, 30, 70, .92)}:root[data-skin=cosmic-glass] .sidebar,:root[data-skin=cosmic-glass] .topbar{background:#080b20f2}}@media(prefers-reduced-motion:no-preference){:root[data-skin=cosmic-glass] .nav a,:root[data-skin=cosmic-glass] button{transition:background-color .15s,border-color .15s,color .15s}}@media(max-width:899px){:root[data-skin=cosmic-glass] body:before{left:0;background:linear-gradient(180deg,#080a1e00,#080a1e33 55%,#080a1e8c),url(./cosmic-glass-bg-Dwx47zPu.webp) 16% 0 / cover no-repeat,var(--bg)}:root[data-skin=cosmic-glass] .sidebar{background:#080b20d1;border-bottom-color:var(--border)}:root[data-skin=cosmic-glass] .panel{padding:14px 16px;background:#0c102899}}
|