@refrakt-md/plan 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.
- package/dist/cli-plugin.d.ts +12 -0
- package/dist/cli-plugin.d.ts.map +1 -0
- package/dist/cli-plugin.js +494 -0
- package/dist/cli-plugin.js.map +1 -0
- package/dist/commands/build.d.ts +14 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +57 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/bundle-behaviors.d.ts +6 -0
- package/dist/commands/bundle-behaviors.d.ts.map +1 -0
- package/dist/commands/bundle-behaviors.js +24 -0
- package/dist/commands/bundle-behaviors.js.map +1 -0
- package/dist/commands/create.d.ts +21 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +50 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/init.d.ts +17 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +109 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/next.d.ts +34 -0
- package/dist/commands/next.d.ts.map +1 -0
- package/dist/commands/next.js +100 -0
- package/dist/commands/next.js.map +1 -0
- package/dist/commands/plan-behaviors.d.ts +2 -0
- package/dist/commands/plan-behaviors.d.ts.map +1 -0
- package/dist/commands/plan-behaviors.js +7 -0
- package/dist/commands/plan-behaviors.js.map +1 -0
- package/dist/commands/render-pipeline.d.ts +70 -0
- package/dist/commands/render-pipeline.d.ts.map +1 -0
- package/dist/commands/render-pipeline.js +1173 -0
- package/dist/commands/render-pipeline.js.map +1 -0
- package/dist/commands/serve.d.ts +13 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +167 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/status.d.ts +53 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +181 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/templates.d.ts +37 -0
- package/dist/commands/templates.d.ts.map +1 -0
- package/dist/commands/templates.js +160 -0
- package/dist/commands/templates.js.map +1 -0
- package/dist/commands/update.d.ts +29 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +238 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/validate.d.ts +29 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +298 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +163 -0
- package/dist/config.js.map +1 -0
- package/dist/filter.d.ts +17 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.js +72 -0
- package/dist/filter.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +144 -0
- package/dist/index.js.map +1 -0
- package/dist/pipeline.d.ts +23 -0
- package/dist/pipeline.d.ts.map +1 -0
- package/dist/pipeline.js +720 -0
- package/dist/pipeline.js.map +1 -0
- package/dist/scanner.d.ts +9 -0
- package/dist/scanner.d.ts.map +1 -0
- package/dist/scanner.js +234 -0
- package/dist/scanner.js.map +1 -0
- package/dist/schema/backlog.d.ts +7 -0
- package/dist/schema/backlog.d.ts.map +1 -0
- package/dist/schema/backlog.js +9 -0
- package/dist/schema/backlog.js.map +1 -0
- package/dist/schema/bug.d.ts +9 -0
- package/dist/schema/bug.d.ts.map +1 -0
- package/dist/schema/bug.js +11 -0
- package/dist/schema/bug.js.map +1 -0
- package/dist/schema/decision-log.d.ts +5 -0
- package/dist/schema/decision-log.d.ts.map +1 -0
- package/dist/schema/decision-log.js +7 -0
- package/dist/schema/decision-log.js.map +1 -0
- package/dist/schema/decision.d.ts +8 -0
- package/dist/schema/decision.d.ts.map +1 -0
- package/dist/schema/decision.js +10 -0
- package/dist/schema/decision.js.map +1 -0
- package/dist/schema/milestone.d.ts +6 -0
- package/dist/schema/milestone.d.ts.map +1 -0
- package/dist/schema/milestone.js +8 -0
- package/dist/schema/milestone.js.map +1 -0
- package/dist/schema/plan-activity.d.ts +4 -0
- package/dist/schema/plan-activity.d.ts.map +1 -0
- package/dist/schema/plan-activity.js +6 -0
- package/dist/schema/plan-activity.js.map +1 -0
- package/dist/schema/plan-progress.d.ts +4 -0
- package/dist/schema/plan-progress.d.ts.map +1 -0
- package/dist/schema/plan-progress.js +6 -0
- package/dist/schema/plan-progress.js.map +1 -0
- package/dist/schema/spec.d.ts +8 -0
- package/dist/schema/spec.d.ts.map +1 -0
- package/dist/schema/spec.js +10 -0
- package/dist/schema/spec.js.map +1 -0
- package/dist/schema/work.d.ts +10 -0
- package/dist/schema/work.d.ts.map +1 -0
- package/dist/schema/work.js +12 -0
- package/dist/schema/work.js.map +1 -0
- package/dist/tags/backlog.d.ts +4 -0
- package/dist/tags/backlog.d.ts.map +1 -0
- package/dist/tags/backlog.js +41 -0
- package/dist/tags/backlog.js.map +1 -0
- package/dist/tags/bug.d.ts +3 -0
- package/dist/tags/bug.d.ts.map +1 -0
- package/dist/tags/bug.js +58 -0
- package/dist/tags/bug.js.map +1 -0
- package/dist/tags/decision-log.d.ts +4 -0
- package/dist/tags/decision-log.d.ts.map +1 -0
- package/dist/tags/decision-log.js +35 -0
- package/dist/tags/decision-log.js.map +1 -0
- package/dist/tags/decision.d.ts +3 -0
- package/dist/tags/decision.d.ts.map +1 -0
- package/dist/tags/decision.js +54 -0
- package/dist/tags/decision.js.map +1 -0
- package/dist/tags/milestone.d.ts +3 -0
- package/dist/tags/milestone.d.ts.map +1 -0
- package/dist/tags/milestone.js +52 -0
- package/dist/tags/milestone.js.map +1 -0
- package/dist/tags/plan-activity.d.ts +4 -0
- package/dist/tags/plan-activity.d.ts.map +1 -0
- package/dist/tags/plan-activity.js +31 -0
- package/dist/tags/plan-activity.js.map +1 -0
- package/dist/tags/plan-progress.d.ts +4 -0
- package/dist/tags/plan-progress.d.ts.map +1 -0
- package/dist/tags/plan-progress.js +31 -0
- package/dist/tags/plan-progress.js.map +1 -0
- package/dist/tags/spec.d.ts +3 -0
- package/dist/tags/spec.d.ts.map +1 -0
- package/dist/tags/spec.js +57 -0
- package/dist/tags/spec.js.map +1 -0
- package/dist/tags/work.d.ts +3 -0
- package/dist/tags/work.d.ts.map +1 -0
- package/dist/tags/work.js +68 -0
- package/dist/tags/work.js.map +1 -0
- package/dist/types.d.ts +69 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +8 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +32 -0
- package/dist/util.js.map +1 -0
- package/package.json +47 -0
- package/styles/default.css +580 -0
- package/styles/minimal.css +379 -0
- package/styles/tokens.css +13 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Template functions for plan item scaffolding.
|
|
3
|
+
* Each returns a Markdoc string ready to write to a file.
|
|
4
|
+
*/
|
|
5
|
+
export const VALID_TYPES = ['work', 'bug', 'decision', 'spec', 'milestone'];
|
|
6
|
+
export function renderTemplate(type, opts) {
|
|
7
|
+
switch (type) {
|
|
8
|
+
case 'work': return workTemplate(opts);
|
|
9
|
+
case 'bug': return bugTemplate(opts);
|
|
10
|
+
case 'decision': return decisionTemplate(opts);
|
|
11
|
+
case 'spec': return specTemplate(opts);
|
|
12
|
+
case 'milestone': return milestoneTemplate(opts);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function attrString(base, extra) {
|
|
16
|
+
const merged = { ...base, ...extra };
|
|
17
|
+
return Object.entries(merged).map(([k, v]) => `${k}="${v}"`).join(' ');
|
|
18
|
+
}
|
|
19
|
+
function workTemplate({ id, title, attrs }) {
|
|
20
|
+
const a = attrString({ id, status: 'draft', priority: 'medium', complexity: 'unknown', tags: '' }, attrs);
|
|
21
|
+
return `{% work ${a} %}
|
|
22
|
+
|
|
23
|
+
# ${title}
|
|
24
|
+
|
|
25
|
+
Description of the change and why it's needed.
|
|
26
|
+
|
|
27
|
+
## Acceptance Criteria
|
|
28
|
+
- [ ] First criterion
|
|
29
|
+
- [ ] Second criterion
|
|
30
|
+
|
|
31
|
+
## Approach
|
|
32
|
+
Technical notes on how to implement.
|
|
33
|
+
|
|
34
|
+
## References
|
|
35
|
+
|
|
36
|
+
{% /work %}
|
|
37
|
+
`;
|
|
38
|
+
}
|
|
39
|
+
function bugTemplate({ id, title, attrs }) {
|
|
40
|
+
const a = attrString({ id, status: 'reported', severity: 'major', tags: '' }, attrs);
|
|
41
|
+
return `{% bug ${a} %}
|
|
42
|
+
|
|
43
|
+
# ${title}
|
|
44
|
+
|
|
45
|
+
## Steps to Reproduce
|
|
46
|
+
1. First step
|
|
47
|
+
2. Second step
|
|
48
|
+
3. Observe the problem
|
|
49
|
+
|
|
50
|
+
## Expected
|
|
51
|
+
What should happen.
|
|
52
|
+
|
|
53
|
+
## Actual
|
|
54
|
+
What actually happens.
|
|
55
|
+
|
|
56
|
+
## Environment
|
|
57
|
+
- Package versions
|
|
58
|
+
|
|
59
|
+
{% /bug %}
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
function decisionTemplate({ id, title, attrs }) {
|
|
63
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
64
|
+
const a = attrString({ id, status: 'proposed', date: today, tags: '' }, attrs);
|
|
65
|
+
return `{% decision ${a} %}
|
|
66
|
+
|
|
67
|
+
# ${title}
|
|
68
|
+
|
|
69
|
+
## Context
|
|
70
|
+
Why this decision is needed.
|
|
71
|
+
|
|
72
|
+
## Options Considered
|
|
73
|
+
1. **Option A** — description, pros, cons
|
|
74
|
+
2. **Option B** — description, pros, cons
|
|
75
|
+
|
|
76
|
+
## Decision
|
|
77
|
+
Which option was chosen.
|
|
78
|
+
|
|
79
|
+
## Rationale
|
|
80
|
+
Why this option was chosen over the alternatives.
|
|
81
|
+
|
|
82
|
+
## Consequences
|
|
83
|
+
What follows from this decision.
|
|
84
|
+
|
|
85
|
+
{% /decision %}
|
|
86
|
+
`;
|
|
87
|
+
}
|
|
88
|
+
function specTemplate({ id, title, attrs }) {
|
|
89
|
+
const a = attrString({ id, status: 'draft', tags: '' }, attrs);
|
|
90
|
+
return `{% spec ${a} %}
|
|
91
|
+
|
|
92
|
+
# ${title}
|
|
93
|
+
|
|
94
|
+
> Brief summary of scope and purpose.
|
|
95
|
+
|
|
96
|
+
## Overview
|
|
97
|
+
|
|
98
|
+
{% /spec %}
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
function milestoneTemplate({ id, title, attrs }) {
|
|
102
|
+
const a = attrString({ name: id, status: 'planning' }, attrs);
|
|
103
|
+
return `{% milestone ${a} %}
|
|
104
|
+
|
|
105
|
+
# ${id} — ${title}
|
|
106
|
+
|
|
107
|
+
- Goal one
|
|
108
|
+
- Goal two
|
|
109
|
+
- Goal three
|
|
110
|
+
|
|
111
|
+
{% /milestone %}
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
/** Status pages generated during init — focused on the most useful statuses per type. */
|
|
115
|
+
export const STATUS_PAGES = [
|
|
116
|
+
// Work items (show=all includes bugs alongside work items)
|
|
117
|
+
{ typeDir: 'work', status: 'in-progress', title: 'In Progress', sort: 'priority', show: 'all' },
|
|
118
|
+
{ typeDir: 'work', status: 'ready', title: 'Ready', sort: 'priority', show: 'all' },
|
|
119
|
+
{ typeDir: 'work', status: 'blocked', title: 'Blocked', sort: 'priority', show: 'all' },
|
|
120
|
+
{ typeDir: 'work', status: 'done', title: 'Done', sort: 'priority', show: 'all' },
|
|
121
|
+
// Specs
|
|
122
|
+
{ typeDir: 'spec', status: 'accepted', title: 'Accepted', sort: 'id', show: 'spec' },
|
|
123
|
+
{ typeDir: 'spec', status: 'draft', title: 'Draft', sort: 'id', show: 'spec' },
|
|
124
|
+
// Decisions
|
|
125
|
+
{ typeDir: 'decision', status: 'accepted', title: 'Accepted', sort: 'id', show: 'decision' },
|
|
126
|
+
{ typeDir: 'decision', status: 'proposed', title: 'Proposed', sort: 'id', show: 'decision' },
|
|
127
|
+
// Milestones
|
|
128
|
+
{ typeDir: 'milestone', status: 'active', title: 'Active', sort: 'id', show: 'milestone' },
|
|
129
|
+
{ typeDir: 'milestone', status: 'complete', title: 'Complete', sort: 'id', show: 'milestone' },
|
|
130
|
+
];
|
|
131
|
+
/** Human-readable labels for type directories. */
|
|
132
|
+
const TYPE_TITLES = {
|
|
133
|
+
work: 'Work Items',
|
|
134
|
+
spec: 'Specifications',
|
|
135
|
+
decision: 'Decisions',
|
|
136
|
+
milestone: 'Milestones',
|
|
137
|
+
};
|
|
138
|
+
/**
|
|
139
|
+
* Render a status filter page containing a backlog rune that filters by status.
|
|
140
|
+
*/
|
|
141
|
+
export function renderStatusPage(def) {
|
|
142
|
+
const showAttr = def.show ? ` show="${def.show}"` : '';
|
|
143
|
+
return `# ${def.title}
|
|
144
|
+
|
|
145
|
+
{% backlog filter="status:${def.status}" sort="${def.sort}"${showAttr} /%}
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Render a type-level index page with links to each status filter page.
|
|
150
|
+
*/
|
|
151
|
+
export function renderTypeIndexPage(typeDir) {
|
|
152
|
+
const title = TYPE_TITLES[typeDir] || typeDir;
|
|
153
|
+
const pages = STATUS_PAGES.filter(p => p.typeDir === typeDir);
|
|
154
|
+
const links = pages.map(p => `- [${p.title}](${p.status})`).join('\n');
|
|
155
|
+
return `# ${title}
|
|
156
|
+
|
|
157
|
+
${links}
|
|
158
|
+
`;
|
|
159
|
+
}
|
|
160
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/commands/templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,CAAC,MAAM,WAAW,GAAmB,CAAC,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;AAS5F,MAAM,UAAU,cAAc,CAAC,IAAkB,EAAE,IAAqB;IACvE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,WAAW,EAAE;CAC9F,CAAC;AAEF,kDAAkD;AAClD,MAAM,WAAW,GAA2B;IAC3C,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,gBAAgB;IACtB,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,YAAY;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAkB;IAClD,MAAM,QAAQ,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACvD,OAAO,KAAK,GAAG,CAAC,KAAK;;4BAEM,GAAG,CAAC,MAAM,WAAW,GAAG,CAAC,IAAI,IAAI,QAAQ;CACpE,CAAC;AACF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,OAAe;IAClD,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC;IAC9C,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC,CAAC;IAC9D,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEvE,OAAO,KAAK,KAAK;;EAEhB,KAAK;CACN,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PlanRuneType } from '../types.js';
|
|
2
|
+
export declare const EXIT_SUCCESS = 0;
|
|
3
|
+
export declare const EXIT_VALIDATION_ERROR = 1;
|
|
4
|
+
export declare const EXIT_NOT_FOUND = 2;
|
|
5
|
+
export interface UpdateOptions {
|
|
6
|
+
id: string;
|
|
7
|
+
dir: string;
|
|
8
|
+
attrs: Record<string, string>;
|
|
9
|
+
check?: string;
|
|
10
|
+
uncheck?: string;
|
|
11
|
+
resolve?: string;
|
|
12
|
+
resolveFile?: string;
|
|
13
|
+
formatJson?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface UpdateResult {
|
|
16
|
+
file: string;
|
|
17
|
+
type: PlanRuneType;
|
|
18
|
+
changes: {
|
|
19
|
+
field: string;
|
|
20
|
+
old: string;
|
|
21
|
+
new: string;
|
|
22
|
+
}[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Execute the plan update command.
|
|
26
|
+
* Returns the result on success, or throws with an error message.
|
|
27
|
+
*/
|
|
28
|
+
export declare function runUpdate(options: UpdateOptions): UpdateResult;
|
|
29
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,aAAa,CAAC;AA0C5D,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACvD;AAsCD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,CA2K9D"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
2
|
+
import { resolve, join } from 'path';
|
|
3
|
+
import { scanPlanFiles } from '../scanner.js';
|
|
4
|
+
// --- Valid attribute values by rune type ---
|
|
5
|
+
const VALID_STATUS = {
|
|
6
|
+
work: ['draft', 'ready', 'in-progress', 'review', 'done', 'blocked'],
|
|
7
|
+
spec: ['draft', 'review', 'accepted', 'superseded', 'deprecated'],
|
|
8
|
+
bug: ['reported', 'confirmed', 'in-progress', 'fixed', 'wontfix', 'duplicate'],
|
|
9
|
+
decision: ['proposed', 'accepted', 'superseded', 'deprecated'],
|
|
10
|
+
milestone: ['planning', 'active', 'complete'],
|
|
11
|
+
};
|
|
12
|
+
const VALID_PRIORITY = ['critical', 'high', 'medium', 'low'];
|
|
13
|
+
const VALID_COMPLEXITY = ['trivial', 'simple', 'moderate', 'complex', 'unknown'];
|
|
14
|
+
const VALID_SEVERITY = ['critical', 'major', 'minor', 'cosmetic'];
|
|
15
|
+
/** Attributes with constrained value sets, by rune type */
|
|
16
|
+
function getEnumAttrs(type) {
|
|
17
|
+
const attrs = {
|
|
18
|
+
status: VALID_STATUS[type],
|
|
19
|
+
};
|
|
20
|
+
if (type === 'work') {
|
|
21
|
+
attrs.priority = VALID_PRIORITY;
|
|
22
|
+
attrs.complexity = VALID_COMPLEXITY;
|
|
23
|
+
}
|
|
24
|
+
if (type === 'bug') {
|
|
25
|
+
attrs.severity = VALID_SEVERITY;
|
|
26
|
+
}
|
|
27
|
+
return attrs;
|
|
28
|
+
}
|
|
29
|
+
/** Attributes allowed per rune type (all of them, not just enums) */
|
|
30
|
+
const ALLOWED_ATTRS = {
|
|
31
|
+
work: ['id', 'status', 'priority', 'complexity', 'assignee', 'milestone', 'tags'],
|
|
32
|
+
spec: ['id', 'status', 'version', 'supersedes', 'tags'],
|
|
33
|
+
bug: ['id', 'status', 'severity', 'assignee', 'milestone', 'tags'],
|
|
34
|
+
decision: ['id', 'status', 'date', 'supersedes', 'tags'],
|
|
35
|
+
milestone: ['name', 'status', 'target'],
|
|
36
|
+
};
|
|
37
|
+
// --- Exit codes ---
|
|
38
|
+
export const EXIT_SUCCESS = 0;
|
|
39
|
+
export const EXIT_VALIDATION_ERROR = 1;
|
|
40
|
+
export const EXIT_NOT_FOUND = 2;
|
|
41
|
+
/**
|
|
42
|
+
* Find a plan entity by ID.
|
|
43
|
+
* Scans all .md files under dir and returns the entity plus its absolute file path.
|
|
44
|
+
*/
|
|
45
|
+
function findEntity(id, dir) {
|
|
46
|
+
const entities = scanPlanFiles(dir);
|
|
47
|
+
const entity = entities.find(e => e.attributes.id === id || e.attributes.name === id);
|
|
48
|
+
if (!entity)
|
|
49
|
+
return null;
|
|
50
|
+
return { entity, absPath: resolve(join(dir, entity.file)) };
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Replace an attribute value in a rune opening tag line.
|
|
54
|
+
* Handles both `attr="value"` and `attr='value'` styles.
|
|
55
|
+
*/
|
|
56
|
+
function replaceAttr(line, attr, newValue) {
|
|
57
|
+
// Match attr="value" or attr='value'
|
|
58
|
+
const regex = new RegExp(`(${attr})=(["'])([^"']*?)\\2`);
|
|
59
|
+
const match = line.match(regex);
|
|
60
|
+
if (match) {
|
|
61
|
+
const oldValue = match[3];
|
|
62
|
+
const quote = match[2];
|
|
63
|
+
const newLine = line.replace(regex, `${attr}=${quote}${newValue}${quote}`);
|
|
64
|
+
return { line: newLine, oldValue };
|
|
65
|
+
}
|
|
66
|
+
return { line, oldValue: null };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Add an attribute to a rune opening tag line (before the closing %}).
|
|
70
|
+
*/
|
|
71
|
+
function addAttr(line, attr, value) {
|
|
72
|
+
// Insert before the closing %}
|
|
73
|
+
return line.replace(/%\}/, `${attr}="${value}" %}`);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Execute the plan update command.
|
|
77
|
+
* Returns the result on success, or throws with an error message.
|
|
78
|
+
*/
|
|
79
|
+
export function runUpdate(options) {
|
|
80
|
+
const { id, dir, attrs, check, uncheck } = options;
|
|
81
|
+
const found = findEntity(id, dir);
|
|
82
|
+
if (!found) {
|
|
83
|
+
const err = new Error(`Entity not found: ${id}`);
|
|
84
|
+
err.exitCode = EXIT_NOT_FOUND;
|
|
85
|
+
throw err;
|
|
86
|
+
}
|
|
87
|
+
const { entity, absPath } = found;
|
|
88
|
+
const changes = [];
|
|
89
|
+
// --- Validate attributes ---
|
|
90
|
+
const enumAttrs = getEnumAttrs(entity.type);
|
|
91
|
+
const allowed = ALLOWED_ATTRS[entity.type];
|
|
92
|
+
for (const [attr, value] of Object.entries(attrs)) {
|
|
93
|
+
if (attr === 'id' || attr === 'name') {
|
|
94
|
+
const err = new Error(`Cannot change the "${attr}" attribute`);
|
|
95
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
96
|
+
throw err;
|
|
97
|
+
}
|
|
98
|
+
if (!allowed.includes(attr)) {
|
|
99
|
+
const err = new Error(`Unknown attribute "${attr}" for ${entity.type} rune. Valid: ${allowed.join(', ')}`);
|
|
100
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
101
|
+
throw err;
|
|
102
|
+
}
|
|
103
|
+
if (enumAttrs[attr]) {
|
|
104
|
+
const valid = enumAttrs[attr];
|
|
105
|
+
if (!valid.includes(value)) {
|
|
106
|
+
const err = new Error(`Invalid ${attr} "${value}" for ${entity.type} rune. Valid: ${valid.join(', ')}`);
|
|
107
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
108
|
+
throw err;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
let content = readFileSync(absPath, 'utf8');
|
|
113
|
+
const lines = content.split('\n');
|
|
114
|
+
// --- Find the rune opening tag line ---
|
|
115
|
+
const tagPattern = new RegExp(`^\\{%\\s+${entity.type}\\s`);
|
|
116
|
+
const tagLineIdx = lines.findIndex(l => tagPattern.test(l));
|
|
117
|
+
if (tagLineIdx === -1) {
|
|
118
|
+
const err = new Error(`Could not find ${entity.type} tag in ${entity.file}`);
|
|
119
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
120
|
+
throw err;
|
|
121
|
+
}
|
|
122
|
+
// --- Apply attribute changes ---
|
|
123
|
+
let tagLine = lines[tagLineIdx];
|
|
124
|
+
for (const [attr, value] of Object.entries(attrs)) {
|
|
125
|
+
const result = replaceAttr(tagLine, attr, value);
|
|
126
|
+
if (result.oldValue !== null) {
|
|
127
|
+
changes.push({ field: attr, old: result.oldValue, new: value });
|
|
128
|
+
tagLine = result.line;
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
// Attribute doesn't exist yet — add it
|
|
132
|
+
tagLine = addAttr(tagLine, attr, value);
|
|
133
|
+
changes.push({ field: attr, old: '', new: value });
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
lines[tagLineIdx] = tagLine;
|
|
137
|
+
// --- Apply checkbox toggling ---
|
|
138
|
+
if (check) {
|
|
139
|
+
const matches = [];
|
|
140
|
+
const checkboxUnchecked = /^([\s]*-\s+)\[ \](\s+.+)/;
|
|
141
|
+
for (let i = 0; i < lines.length; i++) {
|
|
142
|
+
if (checkboxUnchecked.test(lines[i]) && lines[i].includes(check)) {
|
|
143
|
+
matches.push(i);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (matches.length === 0) {
|
|
147
|
+
const err = new Error(`No unchecked criterion matching "${check}"`);
|
|
148
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
149
|
+
throw err;
|
|
150
|
+
}
|
|
151
|
+
if (matches.length > 1) {
|
|
152
|
+
const err = new Error(`Ambiguous: ${matches.length} unchecked criteria match "${check}"`);
|
|
153
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
154
|
+
throw err;
|
|
155
|
+
}
|
|
156
|
+
const idx = matches[0];
|
|
157
|
+
const old = lines[idx];
|
|
158
|
+
lines[idx] = old.replace('[ ]', '[x]');
|
|
159
|
+
const text = old.replace(/^[\s]*-\s+\[ \]\s+/, '').trim();
|
|
160
|
+
changes.push({ field: 'criterion', old: '[ ] ' + text, new: '[x] ' + text });
|
|
161
|
+
}
|
|
162
|
+
if (uncheck) {
|
|
163
|
+
const matches = [];
|
|
164
|
+
const checkboxChecked = /^([\s]*-\s+)\[[xX]\](\s+.+)/;
|
|
165
|
+
for (let i = 0; i < lines.length; i++) {
|
|
166
|
+
if (checkboxChecked.test(lines[i]) && lines[i].includes(uncheck)) {
|
|
167
|
+
matches.push(i);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if (matches.length === 0) {
|
|
171
|
+
const err = new Error(`No checked criterion matching "${uncheck}"`);
|
|
172
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
173
|
+
throw err;
|
|
174
|
+
}
|
|
175
|
+
if (matches.length > 1) {
|
|
176
|
+
const err = new Error(`Ambiguous: ${matches.length} checked criteria match "${uncheck}"`);
|
|
177
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
178
|
+
throw err;
|
|
179
|
+
}
|
|
180
|
+
const idx = matches[0];
|
|
181
|
+
const old = lines[idx];
|
|
182
|
+
lines[idx] = old.replace(/\[[xX]\]/, '[ ]');
|
|
183
|
+
const text = old.replace(/^[\s]*-\s+\[[xX]\]\s+/, '').trim();
|
|
184
|
+
changes.push({ field: 'criterion', old: '[x] ' + text, new: '[ ] ' + text });
|
|
185
|
+
}
|
|
186
|
+
// --- Apply resolution ---
|
|
187
|
+
let resolveBody = options.resolve;
|
|
188
|
+
if (options.resolveFile) {
|
|
189
|
+
resolveBody = readFileSync(resolve(options.resolveFile), 'utf8');
|
|
190
|
+
}
|
|
191
|
+
if (resolveBody !== undefined) {
|
|
192
|
+
// Only allow on work and bug types
|
|
193
|
+
if (entity.type !== 'work' && entity.type !== 'bug') {
|
|
194
|
+
const err = new Error(`Resolution sections are only supported on work and bug items, not ${entity.type}`);
|
|
195
|
+
err.exitCode = EXIT_VALIDATION_ERROR;
|
|
196
|
+
throw err;
|
|
197
|
+
}
|
|
198
|
+
const today = new Date().toISOString().slice(0, 10);
|
|
199
|
+
const resolutionContent = `Completed: ${today}\n\n${resolveBody}`.trimEnd();
|
|
200
|
+
// Check if a ## Resolution section already exists
|
|
201
|
+
const resolutionHeadingIdx = lines.findIndex(l => /^##\s+Resolution\s*$/.test(l));
|
|
202
|
+
if (resolutionHeadingIdx !== -1) {
|
|
203
|
+
// Find the closing rune tag or next H2 heading to know where to insert the append
|
|
204
|
+
let insertIdx = resolutionHeadingIdx + 1;
|
|
205
|
+
for (let i = resolutionHeadingIdx + 1; i < lines.length; i++) {
|
|
206
|
+
const closingTag = new RegExp(`^\\{%\\s+/${entity.type}\\s+%\\}`);
|
|
207
|
+
if (closingTag.test(lines[i]) || /^##\s+[^#]/.test(lines[i])) {
|
|
208
|
+
insertIdx = i;
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
insertIdx = i + 1;
|
|
212
|
+
}
|
|
213
|
+
// Append with separator
|
|
214
|
+
const appendBlock = `\n---\n\n${resolutionContent}\n`;
|
|
215
|
+
lines.splice(insertIdx, 0, appendBlock);
|
|
216
|
+
changes.push({ field: 'resolution', old: '(appended)', new: 'updated' });
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
// Insert new ## Resolution section before the closing rune tag
|
|
220
|
+
const closingTag = new RegExp(`^\\{%\\s+/${entity.type}\\s+%\\}`);
|
|
221
|
+
const closingIdx = lines.findIndex(l => closingTag.test(l));
|
|
222
|
+
if (closingIdx === -1) {
|
|
223
|
+
// No closing tag — append at end
|
|
224
|
+
lines.push('', '## Resolution', '', resolutionContent, '');
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
lines.splice(closingIdx, 0, '## Resolution', '', resolutionContent, '');
|
|
228
|
+
}
|
|
229
|
+
changes.push({ field: 'resolution', old: '', new: 'added' });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// --- Write back ---
|
|
233
|
+
if (changes.length > 0) {
|
|
234
|
+
writeFileSync(absPath, lines.join('\n'));
|
|
235
|
+
}
|
|
236
|
+
return { file: entity.file, type: entity.type, changes };
|
|
237
|
+
}
|
|
238
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,8CAA8C;AAE9C,MAAM,YAAY,GAA4C;IAC7D,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;IACpE,IAAI,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC;IACjE,GAAG,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC;IAC9E,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,CAAC;IAC9D,SAAS,EAAE,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;CAC7C,CAAC;AAEF,MAAM,cAAc,GAAsB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;AAChF,MAAM,gBAAgB,GAAsB,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AACpG,MAAM,cA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AA+D;YAC/D,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,aAAa,MAAM,CAAC,IAAI,UAAU,CAAC,CAAC;YAClE,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5D,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;gBACvB,iCAAiC;gBACjC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACP,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,EAAE,eAAe,EAAE,EAAE,EAAE,iBAAiB,EAAE,EAAE,CAAC,CAAC;YACzE,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9D,CAAC;IACF,CAAC;IAED,qBAAqB;IACrB,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const EXIT_SUCCESS = 0;
|
|
2
|
+
export declare const EXIT_ERRORS = 1;
|
|
3
|
+
export declare const EXIT_INVALID_ARGS = 2;
|
|
4
|
+
export type IssueSeverity = 'error' | 'warning' | 'info';
|
|
5
|
+
export interface ValidationIssue {
|
|
6
|
+
severity: IssueSeverity;
|
|
7
|
+
type: string;
|
|
8
|
+
source: string;
|
|
9
|
+
file: string;
|
|
10
|
+
message: string;
|
|
11
|
+
target?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface ValidateOptions {
|
|
14
|
+
dir: string;
|
|
15
|
+
strict?: boolean;
|
|
16
|
+
formatJson?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface ValidateResult {
|
|
19
|
+
scanned: number;
|
|
20
|
+
issues: ValidationIssue[];
|
|
21
|
+
counts: {
|
|
22
|
+
errors: number;
|
|
23
|
+
warnings: number;
|
|
24
|
+
info: number;
|
|
25
|
+
};
|
|
26
|
+
exitCode: number;
|
|
27
|
+
}
|
|
28
|
+
export declare function runValidate(options: ValidateOptions): ValidateResult;
|
|
29
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAsBA,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,WAAW,IAAI,CAAC;AAC7B,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAInC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,eAAe;IAC/B,QAAQ,EAAE,aAAa,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,QAAQ,EAAE,MAAM,CAAC;CACjB;AAmQD,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,cAAc,CAwCpE"}
|