@open-product-primer/cli 1.2.0 → 2.1.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/README.md +6 -0
- package/dist/cli.js +2 -0
- package/dist/commands/context.d.ts +2 -0
- package/dist/commands/context.js +188 -0
- package/dist/commands/doctor.js +49 -0
- package/dist/commands/init.js +2 -3
- package/dist/commands/update.js +29 -2
- package/dist/lib/config-merge.d.ts +10 -0
- package/dist/lib/config-merge.js +57 -0
- package/dist/lib/install-agent.d.ts +2 -0
- package/dist/lib/install-agent.js +293 -44
- package/dist/lib/integrity.js +2 -1
- package/dist/lib/remote-context.d.ts +50 -0
- package/dist/lib/remote-context.js +299 -0
- package/dist/lib/templates.d.ts +1 -1
- package/dist/lib/templates.js +7 -1
- package/package.json +1 -1
|
@@ -38,10 +38,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.CURSOR_COMMANDS = exports.CURSOR_SKILLS = exports.POOLSIDE_SKILLS = exports.CLAUDE_COMMANDS = exports.CLAUDE_SKILLS = exports.OPRIM_CONTEXT_SKILL_STEP = exports.SUPPORTED_AGENTS = void 0;
|
|
40
40
|
exports.promptFrameworkSelection = promptFrameworkSelection;
|
|
41
|
+
exports.resolveSpecFramework = resolveSpecFramework;
|
|
41
42
|
exports.promptAgentSelection = promptAgentSelection;
|
|
42
43
|
exports.promptPdrSurfacing = promptPdrSurfacing;
|
|
43
44
|
exports.promptOkfFrontmatter = promptOkfFrontmatter;
|
|
44
45
|
exports.installAgentSkills = installAgentSkills;
|
|
46
|
+
exports.specAuthoringSkill = specAuthoringSkill;
|
|
45
47
|
exports.writeAgentInstructionFile = writeAgentInstructionFile;
|
|
46
48
|
exports.codexInstructions = codexInstructions;
|
|
47
49
|
exports.geminiInstructions = geminiInstructions;
|
|
@@ -51,30 +53,60 @@ const fs = __importStar(require("fs"));
|
|
|
51
53
|
const chalk_1 = __importDefault(require("chalk"));
|
|
52
54
|
const scaffold_1 = require("./scaffold");
|
|
53
55
|
const detect_1 = require("./detect");
|
|
56
|
+
const config_merge_1 = require("./config-merge");
|
|
54
57
|
exports.SUPPORTED_AGENTS = ['claude', 'cursor', 'codex', 'gemini', 'poolside'];
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
// oprim/config.yaml (via integrations.spec_framework) is the source of truth for the
|
|
59
|
+
// selected speccing framework; .claude/hooks/config.json is checked only as a fallback for
|
|
60
|
+
// projects that installed before that key existed.
|
|
61
|
+
function readPersistedFramework(projectRoot) {
|
|
62
|
+
const configYamlPath = path.join(projectRoot, 'oprim', 'config.yaml');
|
|
63
|
+
if (fs.existsSync(configYamlPath)) {
|
|
64
|
+
const persisted = (0, config_merge_1.readSpecFramework)(fs.readFileSync(configYamlPath, 'utf-8'));
|
|
65
|
+
if (persisted)
|
|
66
|
+
return persisted;
|
|
67
|
+
}
|
|
68
|
+
const hooksConfigPath = path.join(projectRoot, '.claude', 'hooks', 'config.json');
|
|
69
|
+
if (fs.existsSync(hooksConfigPath)) {
|
|
58
70
|
try {
|
|
59
|
-
const existing = JSON.parse(fs.readFileSync(
|
|
60
|
-
if (typeof existing.framework === 'string')
|
|
61
|
-
console.log(chalk_1.default.dim(` Speccing framework: ${existing.framework} (from config)`));
|
|
71
|
+
const existing = JSON.parse(fs.readFileSync(hooksConfigPath, 'utf-8'));
|
|
72
|
+
if (typeof existing.framework === 'string')
|
|
62
73
|
return existing.framework;
|
|
63
|
-
}
|
|
64
74
|
}
|
|
65
75
|
catch {
|
|
66
|
-
// fallthrough
|
|
76
|
+
// fallthrough
|
|
67
77
|
}
|
|
68
78
|
}
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
async function promptFrameworkSelection(projectRoot) {
|
|
82
|
+
const persisted = readPersistedFramework(projectRoot);
|
|
83
|
+
if (persisted) {
|
|
84
|
+
console.log(chalk_1.default.dim(` Speccing framework: ${persisted} (from config)`));
|
|
85
|
+
return persisted;
|
|
86
|
+
}
|
|
69
87
|
const { select } = await Promise.resolve().then(() => __importStar(require('@inquirer/prompts')));
|
|
70
88
|
return select({
|
|
71
89
|
message: 'Which speccing framework does this project use?',
|
|
72
90
|
choices: [
|
|
73
91
|
{ name: 'OpenSpec (recommended)', value: 'openspec' },
|
|
92
|
+
{ name: 'Native (oprim-authored specs, no OpenSpec required)', value: 'native' },
|
|
74
93
|
{ name: 'None', value: 'none' },
|
|
75
94
|
],
|
|
76
95
|
});
|
|
77
96
|
}
|
|
97
|
+
// No-prompt resolution used where an interactive choice isn't appropriate (e.g. non-Claude
|
|
98
|
+
// agent branches): the persisted value if one exists, else a default derived from the
|
|
99
|
+
// project's existing openspec state.
|
|
100
|
+
function resolveSpecFramework(projectRoot) {
|
|
101
|
+
const persisted = readPersistedFramework(projectRoot);
|
|
102
|
+
if (persisted)
|
|
103
|
+
return persisted;
|
|
104
|
+
const configYamlPath = path.join(projectRoot, 'oprim', 'config.yaml');
|
|
105
|
+
if (fs.existsSync(configYamlPath)) {
|
|
106
|
+
return (0, config_merge_1.deriveDefaultSpecFramework)(fs.readFileSync(configYamlPath, 'utf-8'));
|
|
107
|
+
}
|
|
108
|
+
return 'none';
|
|
109
|
+
}
|
|
78
110
|
async function promptAgentSelection(projectRoot) {
|
|
79
111
|
const detected = (0, detect_1.detectAvailableAgents)(projectRoot);
|
|
80
112
|
if (detected.length > 0) {
|
|
@@ -129,6 +161,21 @@ function installAgentSkills(agent, projectRoot, framework = 'openspec', pdrSurfa
|
|
|
129
161
|
(0, scaffold_1.writeFile)(path.join(skillsBase, name, 'SKILL.md'), skillContent);
|
|
130
162
|
console.log(chalk_1.default.green('✓') + ` .claude/skills/${name}/SKILL.md`);
|
|
131
163
|
}
|
|
164
|
+
// oprim-spec (native spec authoring) — install only when spec_framework is native, remove otherwise
|
|
165
|
+
const specSkillPath = path.join(skillsBase, 'oprim-spec', 'SKILL.md');
|
|
166
|
+
if (framework === 'native') {
|
|
167
|
+
const specSkillContent = pdrSurfacing ? withContextStep(specAuthoringSkill()) : specAuthoringSkill();
|
|
168
|
+
(0, scaffold_1.writeFile)(specSkillPath, specSkillContent);
|
|
169
|
+
console.log(chalk_1.default.green('✓') + ' .claude/skills/oprim-spec/SKILL.md');
|
|
170
|
+
}
|
|
171
|
+
else if (fs.existsSync(specSkillPath)) {
|
|
172
|
+
fs.unlinkSync(specSkillPath);
|
|
173
|
+
try {
|
|
174
|
+
fs.rmdirSync(path.dirname(specSkillPath));
|
|
175
|
+
}
|
|
176
|
+
catch { /* not empty or already gone */ }
|
|
177
|
+
console.log(chalk_1.default.dim(' removed .claude/skills/oprim-spec/SKILL.md'));
|
|
178
|
+
}
|
|
132
179
|
// openspec skills — add/remove Step 0 in-place when they exist
|
|
133
180
|
for (const name of OPENSPEC_SKILL_NAMES) {
|
|
134
181
|
const skillFilePath = path.join(skillsBase, name, 'SKILL.md');
|
|
@@ -144,7 +191,12 @@ function installAgentSkills(agent, projectRoot, framework = 'openspec', pdrSurfa
|
|
|
144
191
|
}
|
|
145
192
|
const cmdsDir = path.join(claudeDir, 'commands', 'oprim');
|
|
146
193
|
for (const [filename, content] of Object.entries(exports.CLAUDE_COMMANDS)) {
|
|
147
|
-
|
|
194
|
+
// promote.md is regenerated per-project since its content branches on the selected
|
|
195
|
+
// speccing framework — the static CLAUDE_COMMANDS entry only reflects the default.
|
|
196
|
+
const finalContent = filename === 'promote.md'
|
|
197
|
+
? claudeWrapper('OPRIM: Promote', 'Promote a note into a bet, or a prioritized bet into a capability spec', promoteContent(framework))
|
|
198
|
+
: content;
|
|
199
|
+
(0, scaffold_1.writeFile)(path.join(cmdsDir, filename), finalContent);
|
|
148
200
|
console.log(chalk_1.default.green('✓') + ` .claude/commands/oprim/${filename}`);
|
|
149
201
|
}
|
|
150
202
|
// Tombstone cleanup: remove command wrappers deleted in v0.2.0 (bet/criteria/pdr/review
|
|
@@ -188,6 +240,19 @@ function installAgentSkills(agent, projectRoot, framework = 'openspec', pdrSurfa
|
|
|
188
240
|
(0, scaffold_1.writeFile)(path.join(skillsBase, name, 'SKILL.md'), content);
|
|
189
241
|
console.log(chalk_1.default.green('✓') + ` .poolside/skills/${name}/SKILL.md`);
|
|
190
242
|
}
|
|
243
|
+
const poolsideSpecSkillPath = path.join(skillsBase, 'oprim-spec', 'SKILL.md');
|
|
244
|
+
if (framework === 'native') {
|
|
245
|
+
(0, scaffold_1.writeFile)(poolsideSpecSkillPath, specAuthoringSkill());
|
|
246
|
+
console.log(chalk_1.default.green('✓') + ' .poolside/skills/oprim-spec/SKILL.md');
|
|
247
|
+
}
|
|
248
|
+
else if (fs.existsSync(poolsideSpecSkillPath)) {
|
|
249
|
+
fs.unlinkSync(poolsideSpecSkillPath);
|
|
250
|
+
try {
|
|
251
|
+
fs.rmdirSync(path.dirname(poolsideSpecSkillPath));
|
|
252
|
+
}
|
|
253
|
+
catch { /* not empty or already gone */ }
|
|
254
|
+
console.log(chalk_1.default.dim(' removed .poolside/skills/oprim-spec/SKILL.md'));
|
|
255
|
+
}
|
|
191
256
|
const agentsFile = path.join(projectRoot, 'AGENTS.md');
|
|
192
257
|
writeAgentInstructionFile(agentsFile, poolsideInstructions());
|
|
193
258
|
console.log(chalk_1.default.green('✓') + ' AGENTS.md (oprim section written)');
|
|
@@ -213,9 +278,27 @@ function installAgentSkills(agent, projectRoot, framework = 'openspec', pdrSurfa
|
|
|
213
278
|
(0, scaffold_1.writeFile)(path.join(skillsBase, name, 'SKILL.md'), content);
|
|
214
279
|
console.log(chalk_1.default.green('✓') + ` .cursor/skills/${name}/SKILL.md`);
|
|
215
280
|
}
|
|
281
|
+
const cursorSpecSkillPath = path.join(skillsBase, 'oprim-spec', 'SKILL.md');
|
|
282
|
+
if (framework === 'native') {
|
|
283
|
+
(0, scaffold_1.writeFile)(cursorSpecSkillPath, specAuthoringSkill());
|
|
284
|
+
console.log(chalk_1.default.green('✓') + ' .cursor/skills/oprim-spec/SKILL.md');
|
|
285
|
+
}
|
|
286
|
+
else if (fs.existsSync(cursorSpecSkillPath)) {
|
|
287
|
+
fs.unlinkSync(cursorSpecSkillPath);
|
|
288
|
+
try {
|
|
289
|
+
fs.rmdirSync(path.dirname(cursorSpecSkillPath));
|
|
290
|
+
}
|
|
291
|
+
catch { /* not empty or already gone */ }
|
|
292
|
+
console.log(chalk_1.default.dim(' removed .cursor/skills/oprim-spec/SKILL.md'));
|
|
293
|
+
}
|
|
216
294
|
const cmdsDir = path.join(cursorDir, 'commands');
|
|
217
295
|
for (const [filename, content] of Object.entries(exports.CURSOR_COMMANDS)) {
|
|
218
|
-
|
|
296
|
+
// oprim-promote.md is regenerated per-project since its content branches on the
|
|
297
|
+
// selected speccing framework — the static CURSOR_COMMANDS entry only reflects the default.
|
|
298
|
+
const finalContent = filename === 'oprim-promote.md'
|
|
299
|
+
? cursorWrapper('oprim-promote', 'Promote a note into a bet, or a prioritized bet into a capability spec', promoteContent(framework))
|
|
300
|
+
: content;
|
|
301
|
+
(0, scaffold_1.writeFile)(path.join(cmdsDir, filename), finalContent);
|
|
219
302
|
console.log(chalk_1.default.green('✓') + ` .cursor/commands/${filename}`);
|
|
220
303
|
}
|
|
221
304
|
if (dirCreated) {
|
|
@@ -299,12 +382,14 @@ exports.CLAUDE_SKILLS = {
|
|
|
299
382
|
'oprim-review': reviewSkill(),
|
|
300
383
|
'oprim-archive': archiveSkill(),
|
|
301
384
|
'oprim-sequence': oprimSequenceSkill(),
|
|
385
|
+
'oprim-context-init': contextInitSkill(),
|
|
302
386
|
};
|
|
303
387
|
// ─── Claude command wrappers (thin, invoke skill) ────────────────────────────
|
|
304
388
|
exports.CLAUDE_COMMANDS = {
|
|
305
|
-
'promote.md': claudeWrapper('OPRIM: Promote', 'Promote a note into a bet, or a prioritized bet into
|
|
389
|
+
'promote.md': claudeWrapper('OPRIM: Promote', 'Promote a note into a bet, or a prioritized bet into a capability spec', promoteContent()),
|
|
306
390
|
'sequence.md': claudeWrapper('OPRIM: Sequence', 'Validate and update the primer sequencing board', sequenceContent()),
|
|
307
391
|
'archive.md': claudeWrapper('OPRIM: Archive', 'Archive a completed bet — move it out of the active board', archiveCommandContent()),
|
|
392
|
+
'context-init.md': claudeWrapper('OPRIM: Context Init', 'Declare the current project a citable remote context, guided by a short Q&A to draft its description', 'Use the Skill tool to invoke the `oprim-context-init` skill.'),
|
|
308
393
|
};
|
|
309
394
|
// ─── Poolside skill playbooks ─────────────────────────────────────────────────
|
|
310
395
|
exports.POOLSIDE_SKILLS = {
|
|
@@ -326,7 +411,7 @@ exports.CURSOR_SKILLS = {
|
|
|
326
411
|
};
|
|
327
412
|
// ─── Cursor command files (full inline — no Skill tool in Cursor) ────────────
|
|
328
413
|
exports.CURSOR_COMMANDS = {
|
|
329
|
-
'oprim-promote.md': cursorWrapper('oprim-promote', 'Promote a note into a bet, or a prioritized bet into
|
|
414
|
+
'oprim-promote.md': cursorWrapper('oprim-promote', 'Promote a note into a bet, or a prioritized bet into a capability spec', promoteContent()),
|
|
330
415
|
'oprim-sequence.md': cursorWrapper('oprim-sequence', 'Validate and update the primer sequencing board', sequenceInlineContent()),
|
|
331
416
|
'oprim-pdr.md': cursorWrapper('oprim-pdr', 'Create a new Product Decision Record with auto-assigned ID', pdrInlineContent()),
|
|
332
417
|
'oprim-bet.md': cursorWrapper('oprim-bet', 'Create a new bet decision and register it on the sequencing board', betInlineContent()),
|
|
@@ -378,6 +463,9 @@ Scan \`oprim/decisions/\` for files matching \`PDR-(\\d+)-\`. Extract all intege
|
|
|
378
463
|
Slug: title → lowercase → spaces to hyphens → remove non-alphanumeric (except hyphens).
|
|
379
464
|
Output path: \`oprim/decisions/PDR-NNN-<slug>.md\`
|
|
380
465
|
|
|
466
|
+
### 2b. Check for custom rules
|
|
467
|
+
Read \`oprim/config.yaml\`. If it has a non-empty \`rules.pdr\` value, treat it as additional guidance from the team — factor it into the questions you ask in step 3 and reflect it in the generated content. If \`rules.pdr\` is absent or empty, skip this step; behavior is unchanged.
|
|
468
|
+
|
|
381
469
|
### 3. Gather content
|
|
382
470
|
Ask: Context (what forced this decision), Decision (clear statement), Alternatives considered (why rejected), Consequences (positives / trade-offs / follow-ups), Evidence links (optional), Related bets (optional), Related OpenSpec changes (optional).
|
|
383
471
|
|
|
@@ -466,6 +554,9 @@ From the bet title: lowercase all characters, replace any character that is not
|
|
|
466
554
|
### 3. Check sequence.yaml exists
|
|
467
555
|
If \`oprim/sequence.yaml\` not found: report and stop — advise \`oprim init\`.
|
|
468
556
|
|
|
557
|
+
### 3b. Check for custom rules
|
|
558
|
+
Read \`oprim/config.yaml\`. If it has a non-empty \`rules.bet\` value, treat it as additional guidance from the team — factor it into the questions you ask in step 4 and reflect it in the generated \`bet-decision.md\` content. If \`rules.bet\` is absent or empty, skip this step; behavior is unchanged.
|
|
559
|
+
|
|
469
560
|
### 4. Gather content
|
|
470
561
|
Ask: Decision (Build now / Defer / Kill, default Build now), Owner, Review date (YYYY-MM-DD), Why now, Alternatives considered, Expected outcomes (metric: baseline → target in timeframe), Kill criteria / rollback trigger, PDR links (optional).
|
|
471
562
|
|
|
@@ -666,10 +757,10 @@ If not: create with \`metrics:\` list.
|
|
|
666
757
|
function archiveSkill() {
|
|
667
758
|
return `---
|
|
668
759
|
name: oprim-archive
|
|
669
|
-
description: Archive a completed bet — moves it to oprim/bets/archived
|
|
760
|
+
description: Archive a completed bet — moves it to oprim/bets/archived/, removes its sequence.yaml entry, and folds any spec deltas under its specs/ directory into oprim/specs/ current truth
|
|
670
761
|
---
|
|
671
762
|
|
|
672
|
-
Archive a completed bet by moving it to \`oprim/bets/archived
|
|
763
|
+
Archive a completed bet by moving it to \`oprim/bets/archived/\`, removing it from \`sequence.yaml\`, and (if present) merging its spec deltas into current truth.
|
|
673
764
|
|
|
674
765
|
**Interactive prompts:** Use the **AskUserQuestion tool** for every question in this skill — do not write questions as plain text.
|
|
675
766
|
|
|
@@ -699,26 +790,50 @@ If neither pattern matches:
|
|
|
699
790
|
- Report: "Bet BET-NNN was not found in oprim/bets/. Nothing was changed."
|
|
700
791
|
- Stop.
|
|
701
792
|
|
|
702
|
-
### 3. Check for active dependencies
|
|
793
|
+
### 3. Check for active dependencies and concurrent spec-delta conflicts
|
|
703
794
|
|
|
704
795
|
Read \`oprim/sequence.yaml\`. Scan every entry across all buckets (now, next, later, backlog) for any entry whose \`blocked_by\` or \`unlocks\` list contains the target bet ID.
|
|
705
796
|
|
|
706
|
-
|
|
707
|
-
|
|
797
|
+
Separately, if \`oprim/bets/<resolved-dir>/specs/\` exists: for each \`<capability>/spec.md\` delta file under it, extract every \`### Requirement:\` header from its \`## ADDED\`/\`## MODIFIED\`/\`## REMOVED Requirements\` sections. Then scan every other bet directory directly under \`oprim/bets/\` (excluding \`archived/\` and the bet being archived) for a \`specs/<capability>/spec.md\` file for the same capability; if one exists, extract its \`### Requirement:\` headers too. Flag any header that matches (whitespace-insensitive) between the archiving bet's delta and another still-active bet's delta as an **overlap**.
|
|
798
|
+
|
|
799
|
+
If either sequence.yaml dependents or delta overlaps are found:
|
|
800
|
+
- Show a combined warning listing each dependent entry and each overlapping requirement.
|
|
708
801
|
|
|
709
802
|
Example:
|
|
710
803
|
\`\`\`
|
|
711
804
|
⚠ Warning: BET-005 is referenced by active bets:
|
|
712
805
|
- BET-007 (blocked_by: [BET-005])
|
|
713
806
|
- BET-008 (unlocks: [BET-005])
|
|
807
|
+
⚠ Warning: BET-005's delta for requirement "The system SHALL ..." in capability foo overlaps with active bet BET-009's delta for the same requirement. Archiving BET-005 now applies its version to oprim/specs/foo/spec.md; if BET-009 archives later, its version will overwrite this requirement again (last-write-wins — no 3-way merge is attempted).
|
|
714
808
|
\`\`\`
|
|
715
|
-
- Ask: "Archive BET-NNN anyway?
|
|
809
|
+
- Ask: "Archive BET-NNN anyway? (y/N)"
|
|
716
810
|
- If "n" or Enter: stop, no changes made.
|
|
717
811
|
- If "y": proceed.
|
|
718
812
|
|
|
719
|
-
If
|
|
813
|
+
If neither is found: proceed without warning.
|
|
720
814
|
|
|
721
|
-
### 4.
|
|
815
|
+
### 4. Fold spec deltas into current truth
|
|
816
|
+
|
|
817
|
+
If \`oprim/bets/<resolved-dir>/specs/\` does not exist: skip this step entirely and go to Step 5 — archive behavior is unchanged from before spec deltas existed.
|
|
818
|
+
|
|
819
|
+
Otherwise, for each capability subdirectory under \`oprim/bets/<resolved-dir>/specs/\` containing a \`spec.md\`:
|
|
820
|
+
|
|
821
|
+
1. Read the delta file's \`## ADDED Requirements\` / \`## MODIFIED Requirements\` / \`## REMOVED Requirements\` sections. Each \`### Requirement:\` block runs from its header through its body and any \`#### Scenario:\` sub-entries, up to the next \`### Requirement:\` or \`## \` header.
|
|
822
|
+
2. Read \`oprim/specs/<capability>/spec.md\` if it exists (current truth uses a single flat \`## Requirements\` section).
|
|
823
|
+
- **If it does not exist:**
|
|
824
|
+
- If the delta is entirely \`## ADDED Requirements\` (no MODIFIED/REMOVED sections): create \`oprim/specs/<capability>/spec.md\` with a \`## Requirements\` header and append each ADDED requirement block beneath it.
|
|
825
|
+
- If the delta contains any MODIFIED or REMOVED requirements: stop before moving anything and report an error — "cannot modify/remove requirement '<header>' in capability <capability> — no current-truth spec exists yet for this capability."
|
|
826
|
+
- **If it does exist:**
|
|
827
|
+
- **ADDED**: append the requirement block to the end of the \`## Requirements\` section.
|
|
828
|
+
- **MODIFIED**: find the existing \`### Requirement:\` block whose header text matches the delta's (whitespace-insensitive); replace that entire block (header, body, and scenarios) with the delta's version. If no match is found, treat it as ADDED instead (append) and note this in the final report.
|
|
829
|
+
- **REMOVED**: find and delete the matching block entirely. If no match is found, note this in the final report and continue — nothing to remove.
|
|
830
|
+
3. Write the updated \`oprim/specs/<capability>/spec.md\`.
|
|
831
|
+
|
|
832
|
+
This fold always overwrites the matched requirement wholesale — it never reconciles two bets' overlapping changes. If a later bet's archive touches the same requirement again, its version simply replaces this one (last-write-wins, confirmed by construction — no 3-way merge).
|
|
833
|
+
|
|
834
|
+
Track which capabilities were merged (and any no-match notes) for the final report.
|
|
835
|
+
|
|
836
|
+
### 5. Move the bet directory to archive
|
|
722
837
|
|
|
723
838
|
Create the archive subfolder if it doesn't exist:
|
|
724
839
|
\`\`\`bash
|
|
@@ -730,11 +845,11 @@ Move the resolved directory:
|
|
|
730
845
|
mv oprim/bets/<resolved-dir> oprim/bets/archived/<resolved-dir>
|
|
731
846
|
\`\`\`
|
|
732
847
|
|
|
733
|
-
###
|
|
848
|
+
### 6. Remove the bet entry from sequence.yaml
|
|
734
849
|
|
|
735
850
|
Read \`oprim/sequence.yaml\`, parse it, and remove the entry with \`id: BET-NNN\` from whichever bucket it appears in (now, next, later, or backlog). Write the updated YAML back using 2-space indentation. Do not modify any other entries.
|
|
736
851
|
|
|
737
|
-
###
|
|
852
|
+
### 7. Report what was done
|
|
738
853
|
|
|
739
854
|
\`\`\`
|
|
740
855
|
## Bet Archived
|
|
@@ -742,6 +857,7 @@ Read \`oprim/sequence.yaml\`, parse it, and remove the entry with \`id: BET-NNN\
|
|
|
742
857
|
**Bet:** BET-NNN
|
|
743
858
|
**Archived to:** oprim/bets/archived/<resolved-dir>/
|
|
744
859
|
**Removed from sequence.yaml:** ✓
|
|
860
|
+
**Spec deltas merged:** <capability-1>, <capability-2> (omit this line if no specs/ directory was present)
|
|
745
861
|
|
|
746
862
|
The bet is preserved in full at the archive location.
|
|
747
863
|
\`\`\`
|
|
@@ -886,6 +1002,9 @@ Create a KPI review in \`oprim/reviews/\`.
|
|
|
886
1002
|
### 1. Identify the bet
|
|
887
1003
|
If not provided, ask: "Which bet are you reviewing? (e.g. BET-042)"
|
|
888
1004
|
|
|
1005
|
+
### 1b. Check for custom rules
|
|
1006
|
+
Read \`oprim/config.yaml\`. If it has a non-empty \`rules.review\` value, treat it as additional guidance from the team — factor it into the questions you ask in step 4 and reflect it in the generated review content. If \`rules.review\` is absent or empty, skip this step; behavior is unchanged.
|
|
1007
|
+
|
|
889
1008
|
### 2. Load criteria and check for a run result
|
|
890
1009
|
|
|
891
1010
|
Read \`oprim/bets/BET-NNN/criteria.yaml\` if it exists (pre-fills baseline and target).
|
|
@@ -940,12 +1059,120 @@ Prepend the frontmatter block from step 5b, if one was prepared.
|
|
|
940
1059
|
### 7. Report what was created
|
|
941
1060
|
`;
|
|
942
1061
|
}
|
|
1062
|
+
function contextInitSkill() {
|
|
1063
|
+
return `---
|
|
1064
|
+
name: oprim-context-init
|
|
1065
|
+
description: Guide the user through drafting a description before declaring the current project a citable remote context
|
|
1066
|
+
---
|
|
1067
|
+
|
|
1068
|
+
Declare the current project a citable remote context, with a clear description other projects and agents can use to decide whether to pull it.
|
|
1069
|
+
|
|
1070
|
+
**Interactive prompts:** Use the **AskUserQuestion tool** for every question in this skill — do not write questions as plain text.
|
|
1071
|
+
|
|
1072
|
+
## What this does
|
|
1073
|
+
|
|
1074
|
+
A remote context is an oprim workspace (decisions, bets, specs) that other projects can reference read-only via \`oprim context register\`. Without a description, other projects have no cheap way to know what a remote context covers short of fully pulling it — so this skill exists to make sure one gets written.
|
|
1075
|
+
|
|
1076
|
+
## Steps
|
|
1077
|
+
|
|
1078
|
+
### 1. Check for an existing identity
|
|
1079
|
+
Check whether \`.oprim-context/context.yaml\` already exists in the current project. If it does, report that a remote context identity already exists (do not re-run the drafting flow below) and stop.
|
|
1080
|
+
|
|
1081
|
+
### 2. Ask what this workspace covers
|
|
1082
|
+
Ask the user, one at a time:
|
|
1083
|
+
- "What does this project's oprim workspace cover? (e.g. product decisions, a specific domain, a team's specs)"
|
|
1084
|
+
- "Who is this meant for — which teams or projects would reference it?"
|
|
1085
|
+
|
|
1086
|
+
If the user declines to answer either question, treat that as opting out of guided drafting — skip to step 4 with no description.
|
|
1087
|
+
|
|
1088
|
+
### 3. Draft and confirm the description
|
|
1089
|
+
From the answers, draft a single-sentence description (aim for under 120 characters — this is what \`oprim context list\` will show other projects). Show the draft to the user and ask: "Use this description? (Enter to accept, or type a replacement)"
|
|
1090
|
+
|
|
1091
|
+
### 4. Call oprim context init
|
|
1092
|
+
- If a description was drafted or accepted: use the Bash tool to run \`oprim context init --description "<final text>"\`.
|
|
1093
|
+
- If the user opted out in step 2: warn clearly that the resulting remote context will show as description-less in \`oprim context list\`, then use the Bash tool to run \`oprim context init\` with no \`--description\` flag.
|
|
1094
|
+
|
|
1095
|
+
### 5. Report what was created
|
|
1096
|
+
Report the path (\`.oprim-context/context.yaml\`) and the description that was set (or the description-less warning, if opted out).
|
|
1097
|
+
`;
|
|
1098
|
+
}
|
|
1099
|
+
function specAuthoringSkill() {
|
|
1100
|
+
return `---
|
|
1101
|
+
name: oprim-spec
|
|
1102
|
+
description: Generate a native oprim capability spec delta at oprim/bets/BET-NNN-<slug>/specs/<capability>/spec.md while a bet is active, in RFC 2119 (SHALL/SHOULD/MAY) requirements and Gherkin scenarios — folded into oprim/specs/<capability>/spec.md (current truth) when the bet is archived
|
|
1103
|
+
---
|
|
1104
|
+
|
|
1105
|
+
Generate a capability spec delta for an active bet — RFC 2119 requirements plus Gherkin scenarios, no OpenSpec required. This skill never writes to \`oprim/specs/\` directly; \`oprim-archive\` folds the delta into current truth when the bet is archived.
|
|
1106
|
+
|
|
1107
|
+
**Interactive prompts:** Use the **AskUserQuestion tool** for every question in this skill — do not write questions as plain text.
|
|
1108
|
+
|
|
1109
|
+
## Steps
|
|
1110
|
+
|
|
1111
|
+
### 1. Get the active bet
|
|
1112
|
+
If a bet ID was provided as context (e.g. invoked from \`/oprim:promote\`), use it directly. Otherwise ask: "Which bet is this spec change for? (e.g. BET-005)"
|
|
1113
|
+
|
|
1114
|
+
Resolve it to a directory in \`oprim/bets/\` using the same two patterns \`oprim-archive\` uses: exact \`BET-NNN/\` (legacy, no slug) or the slug variant \`BET-NNN-<slug>/\`. If neither matches, report "Bet BET-NNN was not found in oprim/bets/ — spec deltas can only be authored against an active bet" and stop.
|
|
1115
|
+
|
|
1116
|
+
### 2. Get the capability name and description
|
|
1117
|
+
If not provided, ask: "What capability are you specifying? (a short name, e.g. 'spec-authoring')" and "What does it do? (one or two sentences)"
|
|
1118
|
+
|
|
1119
|
+
### 2b. Derive the slug
|
|
1120
|
+
From the capability name: lowercase all characters, replace any character that is not a letter or digit with a hyphen, collapse consecutive hyphens to one, strip leading/trailing hyphens. This becomes \`<capability>\`.
|
|
1121
|
+
Output path: \`oprim/bets/<resolved-bet-dir>/specs/<capability>/spec.md\` (a delta, not \`oprim/specs/<capability>/spec.md\` — that file is current truth and is only ever written by \`oprim-archive\`'s merge step).
|
|
1122
|
+
|
|
1123
|
+
### 2c. Check for custom rules
|
|
1124
|
+
Read \`oprim/config.yaml\`. If it has a non-empty \`rules.spec\` value, treat it as additional guidance from the team — factor it into the requirements and scenarios you draft. If \`rules.spec\` is absent or empty, skip this step; behavior is unchanged.
|
|
1125
|
+
|
|
1126
|
+
### 3. Determine the delta type for each requirement
|
|
1127
|
+
For each requirement, ask whether it is new (**ADDED**), a change to an existing current-truth requirement (**MODIFIED**), or a removal of one (**REMOVED**).
|
|
1128
|
+
|
|
1129
|
+
- **ADDED**: gather the requirement statement fresh.
|
|
1130
|
+
- **MODIFIED / REMOVED**: read \`oprim/specs/<capability>/spec.md\` if it exists and list its \`### Requirement:\` headers so the user can pick the one being changed. The header text must match exactly (whitespace-insensitive) for \`oprim-archive\`'s merge step to find it later. If the file doesn't exist yet, MODIFIED/REMOVED aren't possible for this capability — fall back to ADDED.
|
|
1131
|
+
|
|
1132
|
+
### 4. Gather requirements and scenarios
|
|
1133
|
+
For ADDED and MODIFIED requirements, phrase each as an RFC 2119 statement using SHALL (mandatory), SHOULD (recommended), or MAY (optional), then ask for at least one scenario: a WHEN (trigger) and a THEN (expected outcome), with an optional GIVEN (context) and additional AND steps. REMOVED requirements only need the matching header — no new scenarios.
|
|
1134
|
+
|
|
1135
|
+
### 5. Write the delta file
|
|
1136
|
+
Append to (or create) \`oprim/bets/<resolved-bet-dir>/specs/<capability>/spec.md\`, grouping requirements under the matching section header — only include a section if it has at least one requirement under it:
|
|
1137
|
+
|
|
1138
|
+
\`\`\`markdown
|
|
1139
|
+
## ADDED Requirements
|
|
1140
|
+
|
|
1141
|
+
### Requirement: <capability> SHALL/SHOULD/MAY <requirement statement>
|
|
1142
|
+
<one-sentence elaboration>
|
|
1143
|
+
|
|
1144
|
+
#### Scenario: <scenario title>
|
|
1145
|
+
- **GIVEN** <context> (optional)
|
|
1146
|
+
- **WHEN** <trigger>
|
|
1147
|
+
- **THEN** <outcome>
|
|
1148
|
+
- **AND** <additional outcome> (optional)
|
|
1149
|
+
|
|
1150
|
+
## MODIFIED Requirements
|
|
1151
|
+
|
|
1152
|
+
### Requirement: <exact header text matched from oprim/specs/<capability>/spec.md>
|
|
1153
|
+
<revised elaboration>
|
|
1154
|
+
|
|
1155
|
+
#### Scenario: <scenario title>
|
|
1156
|
+
- **WHEN** <trigger>
|
|
1157
|
+
- **THEN** <outcome>
|
|
1158
|
+
|
|
1159
|
+
## REMOVED Requirements
|
|
1160
|
+
|
|
1161
|
+
### Requirement: <exact header text matched from oprim/specs/<capability>/spec.md>
|
|
1162
|
+
\`\`\`
|
|
1163
|
+
|
|
1164
|
+
If the delta file already exists (a prior spec-authoring pass for this bet/capability), append new requirements to the matching section, creating that section if it's not yet present.
|
|
1165
|
+
|
|
1166
|
+
### 6. Report what was created
|
|
1167
|
+
Show the delta file path, which bet it's scoped to, and a summary of the ADDED/MODIFIED/REMOVED requirements captured. Note that it merges into \`oprim/specs/<capability>/spec.md\` when \`BET-NNN\` is archived — nothing is current truth yet.
|
|
1168
|
+
`;
|
|
1169
|
+
}
|
|
943
1170
|
// ─── Cursor inline content (condensed versions for command files) ─────────────
|
|
944
1171
|
function pdrInlineContent() {
|
|
945
|
-
return `Create a new PDR in \`oprim/decisions/\`. Scan for \`PDR-(\\d+)-\` to assign next ID (zero-padded, default 001). Gather: title, context, decision, alternatives, consequences, evidence, related bets/specs. Ask if superseding an existing PDR. Write \`oprim/decisions/PDR-NNN-<slug>.md\`. If superseding: update old PDR Status to "Superseded by PDR-NNN". Report what was created.`;
|
|
1172
|
+
return `Create a new PDR in \`oprim/decisions/\`. Scan for \`PDR-(\\d+)-\` to assign next ID (zero-padded, default 001). Read \`oprim/config.yaml\`'s \`rules.pdr\` — if non-empty, apply it as additional guidance and reflect it in the generated content; if empty, behavior is unchanged. Gather: title, context, decision, alternatives, consequences, evidence, related bets/specs. Ask if superseding an existing PDR. Write \`oprim/decisions/PDR-NNN-<slug>.md\`. If superseding: update old PDR Status to "Superseded by PDR-NNN". Report what was created.`;
|
|
946
1173
|
}
|
|
947
1174
|
function betInlineContent() {
|
|
948
|
-
return `Create a new bet in \`oprim/bets/\`. First explain: "A bet is a product decision you're committing to explore — a problem worth solving, a hypothesis worth testing, or a direction worth taking. You'll name it, explain why now, and set a kill criterion." Then show: "Naming tip: verb + object [for context] — Good: 'Improve bet naming for scannability' / Bad: 'Naming'". Scan \`BET-(\\d+)\` dirs for next ID (zero-padded, default 001). Check \`oprim/sequence.yaml\` exists (stop if not — advise oprim init). After receiving the title, validate: if fewer than 4 words OR fewer than 25 characters, warn "this title may be too vague", suggest a reformulation, and ask "Proceed anyway? (y/N)" — if "n", prompt for a revised title. Gather: decision (default Build now), owner, review date, why-now, alternatives, expected outcomes, kill criteria, PDR links. Write \`oprim/bets/BET-NNN/bet-decision.md\` with an inline naming tip comment in the header. Append entry to sequence.yaml backlog: \`{id, title, blocked_by: [], unlocks: [], requires_pdrs: []}\`. Then ask: "Do you want to scaffold a discovery.md now? (y/N)" — if "y", write \`oprim/bets/BET-NNN/discovery.md\` from the discovery template (sections: Problem Framing, User Research Signals, Competitive Context, Open Questions); if "n" or Enter, skip silently. Report what was created.`;
|
|
1175
|
+
return `Create a new bet in \`oprim/bets/\`. First explain: "A bet is a product decision you're committing to explore — a problem worth solving, a hypothesis worth testing, or a direction worth taking. You'll name it, explain why now, and set a kill criterion." Then show: "Naming tip: verb + object [for context] — Good: 'Improve bet naming for scannability' / Bad: 'Naming'". Scan \`BET-(\\d+)\` dirs for next ID (zero-padded, default 001). Check \`oprim/sequence.yaml\` exists (stop if not — advise oprim init). Read \`oprim/config.yaml\`'s \`rules.bet\` — if non-empty, apply it as additional guidance and reflect it in the generated content; if empty, behavior is unchanged. After receiving the title, validate: if fewer than 4 words OR fewer than 25 characters, warn "this title may be too vague", suggest a reformulation, and ask "Proceed anyway? (y/N)" — if "n", prompt for a revised title. Gather: decision (default Build now), owner, review date, why-now, alternatives, expected outcomes, kill criteria, PDR links. Write \`oprim/bets/BET-NNN/bet-decision.md\` with an inline naming tip comment in the header. Append entry to sequence.yaml backlog: \`{id, title, blocked_by: [], unlocks: [], requires_pdrs: []}\`. Then ask: "Do you want to scaffold a discovery.md now? (y/N)" — if "y", write \`oprim/bets/BET-NNN/discovery.md\` from the discovery template (sections: Problem Framing, User Research Signals, Competitive Context, Open Questions); if "n" or Enter, skip silently. Report what was created.`;
|
|
949
1176
|
}
|
|
950
1177
|
function noteInlineContent() {
|
|
951
1178
|
return `Create a new note in \`oprim/notes/\` for lightweight thinking capture — an observation, idea, or connection that hasn't yet earned a place in a bet or PDR. Notes carry no owner or kill criterion; promote one into a bet later with \`/oprim:promote NOTE-NNN\`. Ask for a short title. Scan \`oprim/notes/NOTE-(\\d+)-\` for the next id (zero-padded, default 001). Ask for the note body (free-form), tags, and optional related BET-IDs. Tags are checked against \`oprim/config.yaml\`'s \`notes.tags\`; any new tag is accepted and appended to that list rather than rejected — the vocabulary grows from usage. Read \`oprim/templates/note.md\` — if its frontmatter has a \`description:\` field, this workspace is on the OKF tier and needs a one-line description; if it has no \`description:\` field, use the minimal tier; if the file doesn't exist, fall back to reading \`okf.enabled\` directly from \`oprim/config.yaml\`. Write \`oprim/notes/NOTE-NNN-<slug>.md\` with the correct frontmatter tier and a \`## Bets\` section listing any related BET-IDs. For each related bet, append \`- Notes: NOTE-NNN\` to that bet-decision's \`## Links\` section. Report what was created.`;
|
|
@@ -954,7 +1181,7 @@ function criteriaInlineContent() {
|
|
|
954
1181
|
return `Add metrics to \`oprim/bets/BET-NNN/criteria.yaml\`. Verify bet dir exists. Gather: metric ID, name, baseline, target, timeframe, launch date, segment. Ask source type (amplitude or bigquery). Amplitude: event, aggregation, denominator_event. BigQuery: table, metric_column, filter, aggregation, denominator_query. If file exists: append to metrics list (never overwrite). If not: create. Ask if adding more metrics. Report what was created.`;
|
|
955
1182
|
}
|
|
956
1183
|
function reviewInlineContent() {
|
|
957
|
-
return `Create KPI review in \`oprim/reviews/YYYY-MM-DD-BET-NNN-kpi.md\`. Read \`criteria.yaml\` for pre-fill (baseline/target). Check \`oprim/bets/BET-NNN/measurements/\` for \`run-*.yaml\` files — if found, use the most recent to pre-populate actuals and status (include "Actuals from run: YYYY-MM-DD" note). If no run result, ask for each metric's actual value. Status: actual >= target → hit, actual < target → missed, not provided → pending. Ask reviewer name and decision quality notes. Write review with metric table and Actions checklist. Report what was created.`;
|
|
1184
|
+
return `Create KPI review in \`oprim/reviews/YYYY-MM-DD-BET-NNN-kpi.md\`. Read \`oprim/config.yaml\`'s \`rules.review\` — if non-empty, apply it as additional guidance and reflect it in the generated content; if empty, behavior is unchanged. Read \`criteria.yaml\` for pre-fill (baseline/target). Check \`oprim/bets/BET-NNN/measurements/\` for \`run-*.yaml\` files — if found, use the most recent to pre-populate actuals and status (include "Actuals from run: YYYY-MM-DD" note). If no run result, ask for each metric's actual value. Status: actual >= target → hit, actual < target → missed, not provided → pending. Ask reviewer name and decision quality notes. Write review with metric table and Actions checklist. Report what was created.`;
|
|
958
1185
|
}
|
|
959
1186
|
// ─── Hook scripts: co-archival coordination ──────────────────────────────────
|
|
960
1187
|
function hooksConfig(framework) {
|
|
@@ -1106,20 +1333,14 @@ function mergeClaudeSettingsHooks(claudeDir) {
|
|
|
1106
1333
|
console.log(chalk_1.default.green('✓') + ' .claude/settings.json (UserPromptSubmit + Stop hooks registered)');
|
|
1107
1334
|
}
|
|
1108
1335
|
// ─── Legacy content (promote remains inline; sequence now delegates to skill) ─
|
|
1109
|
-
function promoteContent() {
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
- \`NOTE-\` → **B. Note → Bet**
|
|
1118
|
-
- Anything else → report "Unrecognized ID prefix — expected BET- or NOTE-" and stop. Do not silently do nothing.
|
|
1119
|
-
|
|
1120
|
-
## A. Bet → OpenSpec change
|
|
1121
|
-
|
|
1122
|
-
1. **Locate the bet** — read \`oprim/bets/BET-XXX/bet-decision.md\`
|
|
1336
|
+
function promoteContent(framework = 'openspec') {
|
|
1337
|
+
const sectionATitle = framework === 'openspec'
|
|
1338
|
+
? 'A. Bet → OpenSpec change'
|
|
1339
|
+
: framework === 'native'
|
|
1340
|
+
? 'A. Bet → native oprim spec'
|
|
1341
|
+
: 'A. Bet → spec (no framework configured)';
|
|
1342
|
+
const sectionABody = framework === 'openspec'
|
|
1343
|
+
? `1. **Locate the bet** — read \`oprim/bets/BET-XXX/bet-decision.md\`
|
|
1123
1344
|
2. **Validate status** — decision must be "Build now"
|
|
1124
1345
|
3. **Check authority boundary** — confirm primer artifact owns why/order/outcome only
|
|
1125
1346
|
4. **Create OpenSpec change** — derive the change name as \`bet-NNN-<slug>\` where \`NNN\` is the zero-padded bet number (e.g. BET-004 → \`bet-004\`) and \`<slug>\` is a short kebab-case summary of the change. Then invoke the \`/openspec-propose\` skill (or \`/opsx:propose\`) with that name to create the change directory with **all required artifacts**: \`proposal.md\`, \`design.md\`, \`tasks.md\`, and \`specs/<capability>/spec.md\` for every capability listed under \`## Capabilities\`.
|
|
@@ -1136,7 +1357,31 @@ Promote an atomic note into a bet, or a prioritized bet into an OpenSpec change.
|
|
|
1136
1357
|
- \`tasks.md\`
|
|
1137
1358
|
- \`specs/<capability>/spec.md\` for each capability in \`## Capabilities\`
|
|
1138
1359
|
If any artifact is missing, create it before reporting done.
|
|
1139
|
-
8. **Report** — show what was linked and what remains for engineering
|
|
1360
|
+
8. **Report** — show what was linked and what remains for engineering`
|
|
1361
|
+
: framework === 'native'
|
|
1362
|
+
? `1. **Locate the bet** — read \`oprim/bets/BET-XXX/bet-decision.md\`
|
|
1363
|
+
2. **Validate status** — decision must be "Build now"
|
|
1364
|
+
3. **Check authority boundary** — confirm primer artifact owns why/order/outcome only
|
|
1365
|
+
4. **Generate the native spec delta(s)** — for each capability listed under the bet's \`## Capabilities\` section (or a single capability derived from the bet title if none is listed), invoke the \`oprim-spec\` skill with this bet as context to write \`oprim/bets/BET-XXX/specs/<capability>/spec.md\` — a delta using \`## ADDED\`/\`## MODIFIED\`/\`## REMOVED Requirements\` headers reflecting the bet's why/outcome. No OpenSpec change directory is created and OpenSpec need not be installed. Nothing is written to \`oprim/specs/<capability>/spec.md\` (current truth) at promote time — that only happens when this bet is archived.
|
|
1366
|
+
5. **Link artifacts** — add \`- Spec (delta): oprim/bets/BET-XXX/specs/<capability>/spec.md\` (one line per capability) to the bet-decision \`## Links\` section
|
|
1367
|
+
6. **Copy criteria** — if \`oprim/bets/BET-XXX/criteria.yaml\` exists, note it alongside the spec link
|
|
1368
|
+
7. **Report** — show what was created and linked, and note that merge-on-archive will fold the delta into \`oprim/specs/\` when the bet archives`
|
|
1369
|
+
: `1. **Locate the bet** — read \`oprim/bets/BET-XXX/bet-decision.md\`
|
|
1370
|
+
2. **Validate status** — decision must be "Build now"
|
|
1371
|
+
3. **Report and stop** — no speccing framework is configured (\`integrations.spec_framework: none\`). Add \`- Spec: none (no speccing framework configured)\` to the bet-decision \`## Links\` section. No spec artifact is created.`;
|
|
1372
|
+
return `
|
|
1373
|
+
Promote an atomic note into a bet, or a prioritized bet into a capability spec. The promotion path is determined solely by the prefix of the ID argument — there is no separate command for each.
|
|
1374
|
+
|
|
1375
|
+
**Input**: Specify an ID (e.g., \`/oprim:promote BET-042\` or \`/oprim:promote NOTE-005\`) or omit to be prompted.
|
|
1376
|
+
|
|
1377
|
+
### 0. Determine the promotion path from the ID prefix
|
|
1378
|
+
- \`BET-\` → **${sectionATitle}**
|
|
1379
|
+
- \`NOTE-\` → **B. Note → Bet**
|
|
1380
|
+
- Anything else → report "Unrecognized ID prefix — expected BET- or NOTE-" and stop. Do not silently do nothing.
|
|
1381
|
+
|
|
1382
|
+
## ${sectionATitle}
|
|
1383
|
+
|
|
1384
|
+
${sectionABody}
|
|
1140
1385
|
|
|
1141
1386
|
## B. Note → Bet
|
|
1142
1387
|
|
|
@@ -1200,6 +1445,7 @@ Create a new bet in \`oprim/bets/\` and register it on the sequencing board.
|
|
|
1200
1445
|
2. Ask for the bet title. Validate: fewer than 4 words OR fewer than 25 chars → warn, suggest reformulation, ask "Proceed anyway? (y/N)".
|
|
1201
1446
|
3. Assign next BET ID: scan \`oprim/bets/BET-(\\d+)\` dirs, max+1 zero-padded to 3 digits (default 001).
|
|
1202
1447
|
4. Check \`oprim/sequence.yaml\` exists — stop if not, advise \`oprim init\`.
|
|
1448
|
+
4b. Read \`oprim/config.yaml\`'s \`rules.bet\` — if non-empty, apply it as additional guidance and reflect it in the generated content; if empty, behavior is unchanged.
|
|
1203
1449
|
5. Gather: decision (default Build now), owner, review date (YYYY-MM-DD), why now, alternatives, expected outcomes, kill criteria, PDR links.
|
|
1204
1450
|
6. Write \`oprim/bets/BET-NNN/bet-decision.md\` with all fields.
|
|
1205
1451
|
7. Append to \`oprim/sequence.yaml\` backlog: \`{id, title, blocked_by: [], unlocks: [], requires_pdrs: []}\`.
|
|
@@ -1235,6 +1481,7 @@ Create a new Product Decision Record in \`oprim/decisions/\`.
|
|
|
1235
1481
|
|
|
1236
1482
|
1. Ask for decision title.
|
|
1237
1483
|
2. Assign next PDR ID: scan \`oprim/decisions/PDR-(\\d+)-\`, max+1 zero-padded to 3 digits (default 001).
|
|
1484
|
+
2b. Read \`oprim/config.yaml\`'s \`rules.pdr\` — if non-empty, apply it as additional guidance and reflect it in the generated content; if empty, behavior is unchanged.
|
|
1238
1485
|
3. Gather: context, decision, alternatives, consequences, evidence, related bets/specs.
|
|
1239
1486
|
4. Ask if superseding an existing PDR.
|
|
1240
1487
|
5. Write \`oprim/decisions/PDR-NNN-<slug>.md\`. If superseding, update old PDR Status.
|
|
@@ -1244,6 +1491,7 @@ Create a new Product Decision Record in \`oprim/decisions/\`.
|
|
|
1244
1491
|
Create a KPI review artifact in \`oprim/reviews/\`.
|
|
1245
1492
|
|
|
1246
1493
|
1. Ask which bet (e.g. BET-042).
|
|
1494
|
+
1b. Read \`oprim/config.yaml\`'s \`rules.review\` — if non-empty, apply it as additional guidance and reflect it in the generated content; if empty, behavior is unchanged.
|
|
1247
1495
|
2. Read \`oprim/bets/BET-NNN/criteria.yaml\` for pre-fill. Check \`oprim/bets/BET-NNN/measurements/\` for \`run-*.yaml\` — use most recent if present.
|
|
1248
1496
|
3. If no run result, ask for each metric's actual value.
|
|
1249
1497
|
4. Status: actual >= target → hit; actual < target → missed; not provided → pending.
|
|
@@ -1256,10 +1504,11 @@ Archive a completed bet.
|
|
|
1256
1504
|
|
|
1257
1505
|
1. Ask for bet ID (accept bet-005, 005, 5, BET-005 — normalize to BET-NNN).
|
|
1258
1506
|
2. Verify \`oprim/bets/BET-NNN/\` exists.
|
|
1259
|
-
3. Check \`oprim/sequence.yaml\` for entries where \`blocked_by\` or \`unlocks\` reference the target bet — warn if found,
|
|
1260
|
-
4.
|
|
1261
|
-
5.
|
|
1262
|
-
6.
|
|
1507
|
+
3. Check \`oprim/sequence.yaml\` for entries where \`blocked_by\` or \`unlocks\` reference the target bet — warn if found. Also check other active bet dirs for delta specs against the same requirement (matching \`### Requirement:\` headers, whitespace-insensitive) — warn if an overlap is found. Ask "Archive anyway? (y/N)" if either warning fires.
|
|
1508
|
+
4. If \`oprim/bets/BET-NNN/specs/\` exists, fold each capability's \`## ADDED\`/\`## MODIFIED\`/\`## REMOVED Requirements\` delta into \`oprim/specs/<capability>/spec.md\` (matching by \`### Requirement:\` header; create the current-truth file if the delta is entirely ADDED) — last-write-wins on overlaps, no 3-way merge. Skip this step entirely if no \`specs/\` dir is present.
|
|
1509
|
+
5. Move directory: \`oprim/bets/BET-NNN → oprim/bets/archived/BET-NNN\`.
|
|
1510
|
+
6. Remove the bet entry from \`oprim/sequence.yaml\`.
|
|
1511
|
+
7. Report what was done.
|
|
1263
1512
|
|
|
1264
1513
|
### Sequencing board (oprim-sequence)
|
|
1265
1514
|
Validate the primer sequencing board and regenerate the visual view.
|
package/dist/lib/integrity.js
CHANGED
|
@@ -97,7 +97,8 @@ function checkSkillVersionDrift(projectRoot, checks) {
|
|
|
97
97
|
const skillsDir = path.join(projectRoot, '.claude', 'skills');
|
|
98
98
|
if (!fs.existsSync(skillsDir))
|
|
99
99
|
return;
|
|
100
|
-
|
|
100
|
+
const bundledSkills = { ...install_agent_1.CLAUDE_SKILLS, 'oprim-spec': (0, install_agent_1.specAuthoringSkill)() };
|
|
101
|
+
for (const [name, bundledContent] of Object.entries(bundledSkills)) {
|
|
101
102
|
const skillPath = path.join(skillsDir, name, 'SKILL.md');
|
|
102
103
|
if (!fs.existsSync(skillPath))
|
|
103
104
|
continue;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export interface GitSource {
|
|
2
|
+
name: string;
|
|
3
|
+
git: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PathSource {
|
|
7
|
+
name: string;
|
|
8
|
+
path: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
export type RemoteContextSource = GitSource | PathSource;
|
|
12
|
+
export interface RemoteContextConfig {
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
sources: RemoteContextSource[];
|
|
15
|
+
}
|
|
16
|
+
export interface RemoteContextIdentity {
|
|
17
|
+
name: string;
|
|
18
|
+
version: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function isGitSource(source: RemoteContextSource): source is GitSource;
|
|
22
|
+
export declare function isPathSource(source: RemoteContextSource): source is PathSource;
|
|
23
|
+
export declare function readRemoteContextConfig(projectRoot: string): RemoteContextConfig;
|
|
24
|
+
export declare function writeRemoteContextConfig(projectRoot: string, config: RemoteContextConfig): void;
|
|
25
|
+
export declare function findSourceByName(config: RemoteContextConfig, name: string): RemoteContextSource | undefined;
|
|
26
|
+
export declare function identityFilePath(rootDir: string): string;
|
|
27
|
+
export declare function readIdentity(rootDir: string): RemoteContextIdentity | null;
|
|
28
|
+
export declare function writeIdentity(rootDir: string, identity: RemoteContextIdentity): void;
|
|
29
|
+
export interface ResolvedIdentity {
|
|
30
|
+
identity: RemoteContextIdentity | null;
|
|
31
|
+
stale: boolean;
|
|
32
|
+
error?: string;
|
|
33
|
+
nameMismatch?: {
|
|
34
|
+
declared: string;
|
|
35
|
+
resolved: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface ResolvedContent {
|
|
39
|
+
workspaceRoot: string;
|
|
40
|
+
stale: boolean;
|
|
41
|
+
error?: string;
|
|
42
|
+
nameMismatch?: {
|
|
43
|
+
declared: string;
|
|
44
|
+
resolved: string;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export declare function resolveIdentityOnly(source: RemoteContextSource): ResolvedIdentity;
|
|
48
|
+
export declare function hasEverFullyResolved(source: RemoteContextSource): boolean;
|
|
49
|
+
export declare function resolveFull(source: RemoteContextSource): ResolvedContent;
|
|
50
|
+
export declare function assembleOprimWorkspaceContent(workspaceRoot: string): string;
|