@codewalla_india/openspec 1.3.0 → 1.3.2
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/LICENSE +22 -22
- package/README.md +272 -230
- package/bin/openspec.js +5 -5
- package/dist/cli/index.js +99 -62
- package/dist/commands/change.d.ts +0 -2
- package/dist/commands/change.js +107 -86
- package/dist/commands/config.js +14 -16
- package/dist/commands/doctor.js +9 -4
- package/dist/commands/feedback.js +79 -30
- package/dist/commands/modify.d.ts +26 -0
- package/dist/commands/modify.js +147 -0
- package/dist/commands/schema.js +170 -91
- package/dist/commands/show.js +5 -2
- package/dist/commands/spec.js +49 -29
- package/dist/commands/store.js +15 -21
- package/dist/commands/validate.d.ts +8 -0
- package/dist/commands/validate.js +43 -20
- package/dist/commands/workflow/index.d.ts +2 -2
- package/dist/commands/workflow/index.js +1 -1
- package/dist/commands/workflow/instructions.d.ts +6 -26
- package/dist/commands/workflow/instructions.js +183 -376
- package/dist/commands/workflow/new-change.d.ts +0 -4
- package/dist/commands/workflow/new-change.js +10 -28
- package/dist/commands/workflow/shared.d.ts +34 -19
- package/dist/commands/workflow/shared.js +34 -4
- package/dist/commands/workflow/status.js +10 -32
- package/dist/commands/workflow/templates.js +15 -5
- package/dist/commands/workset.d.ts +2 -2
- package/dist/commands/workset.js +19 -22
- package/dist/comprehension-quiz/fingerprint.d.ts +39 -0
- package/dist/comprehension-quiz/fingerprint.js +84 -0
- package/dist/comprehension-quiz/index.d.ts +42 -0
- package/dist/comprehension-quiz/index.js +47 -0
- package/dist/comprehension-quiz/pass-record.d.ts +44 -0
- package/dist/comprehension-quiz/pass-record.js +98 -0
- package/dist/comprehension-quiz/providers/anthropic.d.ts +34 -0
- package/dist/comprehension-quiz/providers/anthropic.js +53 -0
- package/dist/comprehension-quiz/providers/factory.d.ts +44 -0
- package/dist/comprehension-quiz/providers/factory.js +174 -0
- package/dist/comprehension-quiz/providers/interface.d.ts +59 -0
- package/dist/comprehension-quiz/providers/interface.js +63 -0
- package/dist/comprehension-quiz/providers/local.d.ts +34 -0
- package/dist/comprehension-quiz/providers/local.js +53 -0
- package/dist/comprehension-quiz/providers/ollama.d.ts +34 -0
- package/dist/comprehension-quiz/providers/ollama.js +53 -0
- package/dist/comprehension-quiz/providers/openai.d.ts +34 -0
- package/dist/comprehension-quiz/providers/openai.js +53 -0
- package/dist/comprehension-quiz/question-generator.d.ts +69 -0
- package/dist/comprehension-quiz/question-generator.js +141 -0
- package/dist/comprehension-quiz/quiz-executor.d.ts +70 -0
- package/dist/comprehension-quiz/quiz-executor.js +165 -0
- package/dist/comprehension-quiz/types.d.ts +115 -0
- package/dist/comprehension-quiz/types.js +11 -0
- package/dist/core/archive.d.ts +14 -1
- package/dist/core/archive.js +1350 -190
- package/dist/core/artifact-graph/graph.d.ts +28 -9
- package/dist/core/artifact-graph/graph.js +94 -43
- package/dist/core/artifact-graph/index.d.ts +1 -1
- package/dist/core/artifact-graph/index.js +1 -1
- package/dist/core/artifact-graph/instruction-loader.d.ts +30 -3
- package/dist/core/artifact-graph/instruction-loader.js +70 -12
- package/dist/core/artifact-graph/outputs.d.ts +1 -0
- package/dist/core/artifact-graph/outputs.js +67 -5
- package/dist/core/artifact-graph/resolver.d.ts +14 -0
- package/dist/core/artifact-graph/resolver.js +69 -15
- package/dist/core/artifact-graph/types.js +21 -3
- package/dist/core/available-tools.d.ts +2 -2
- package/dist/core/available-tools.js +14 -3
- package/dist/core/change-metadata/schema.d.ts +2 -0
- package/dist/core/change-metadata/schema.js +13 -0
- package/dist/core/change-status-policy.d.ts +10 -1
- package/dist/core/change-status-policy.js +30 -2
- package/dist/core/command-generation/adapters/amazon-q.d.ts +4 -0
- package/dist/core/command-generation/adapters/amazon-q.js +11 -5
- package/dist/core/command-generation/adapters/antigravity.js +6 -5
- package/dist/core/command-generation/adapters/auggie.js +7 -6
- package/dist/core/command-generation/adapters/bob.d.ts +5 -1
- package/dist/core/command-generation/adapters/bob.js +11 -10
- package/dist/core/command-generation/adapters/claude.d.ts +1 -1
- package/dist/core/command-generation/adapters/claude.js +12 -17
- package/dist/core/command-generation/adapters/cline.js +5 -5
- package/dist/core/command-generation/adapters/codebuddy.js +8 -7
- package/dist/core/command-generation/adapters/continue.js +8 -7
- package/dist/core/command-generation/adapters/costrict.js +7 -6
- package/dist/core/command-generation/adapters/crush.js +9 -9
- package/dist/core/command-generation/adapters/cursor.js +8 -8
- package/dist/core/command-generation/adapters/devin.d.ts +19 -0
- package/dist/core/command-generation/adapters/devin.js +36 -0
- package/dist/core/command-generation/adapters/factory.js +7 -6
- package/dist/core/command-generation/adapters/gemini.js +40 -5
- package/dist/core/command-generation/adapters/github-copilot.js +6 -5
- package/dist/core/command-generation/adapters/iflow.js +9 -8
- package/dist/core/command-generation/adapters/index.d.ts +4 -2
- package/dist/core/command-generation/adapters/index.js +4 -2
- package/dist/core/command-generation/adapters/junie.js +6 -5
- package/dist/core/command-generation/adapters/kilocode.js +1 -1
- package/dist/core/command-generation/adapters/kiro.js +6 -5
- package/dist/core/command-generation/adapters/lingma.js +9 -9
- package/dist/core/command-generation/adapters/oh-my-pi.d.ts +21 -0
- package/dist/core/command-generation/adapters/oh-my-pi.js +42 -0
- package/dist/core/command-generation/adapters/opencode.js +6 -8
- package/dist/core/command-generation/adapters/pi.d.ts +2 -2
- package/dist/core/command-generation/adapters/pi.js +7 -10
- package/dist/core/command-generation/adapters/qoder.js +9 -9
- package/dist/core/command-generation/adapters/qwen.d.ts +7 -3
- package/dist/core/command-generation/adapters/qwen.js +14 -9
- package/dist/core/command-generation/adapters/roocode.d.ts +4 -4
- package/dist/core/command-generation/adapters/roocode.js +9 -9
- package/dist/core/command-generation/adapters/trae.d.ts +13 -0
- package/dist/core/command-generation/adapters/trae.js +28 -0
- package/dist/core/command-generation/adapters/zcode.d.ts +16 -0
- package/dist/core/command-generation/adapters/zcode.js +33 -0
- package/dist/core/command-generation/generator.d.ts +8 -0
- package/dist/core/command-generation/generator.js +15 -1
- package/dist/core/command-generation/index.d.ts +1 -1
- package/dist/core/command-generation/index.js +1 -1
- package/dist/core/command-generation/invocation.d.ts +73 -0
- package/dist/core/command-generation/invocation.js +77 -0
- package/dist/core/command-generation/registry.js +8 -4
- package/dist/core/command-generation/types.d.ts +9 -2
- package/dist/core/command-generation/yaml.d.ts +20 -6
- package/dist/core/command-generation/yaml.js +31 -21
- package/dist/core/command-surface.d.ts +15 -0
- package/dist/core/command-surface.js +33 -0
- package/dist/core/completions/command-registry.js +16 -61
- package/dist/core/completions/generators/bash-generator.js +41 -41
- package/dist/core/completions/generators/fish-generator.js +7 -7
- package/dist/core/completions/generators/powershell-generator.js +44 -37
- package/dist/core/completions/generators/zsh-generator.js +33 -33
- package/dist/core/completions/installers/zsh-installer.d.ts +9 -0
- package/dist/core/completions/installers/zsh-installer.js +20 -4
- package/dist/core/completions/templates/bash-templates.js +24 -24
- package/dist/core/completions/templates/fish-templates.js +38 -38
- package/dist/core/completions/templates/powershell-templates.js +28 -28
- package/dist/core/completions/templates/zsh-templates.js +39 -39
- package/dist/core/config-prompts.d.ts +1 -1
- package/dist/core/config-prompts.js +14 -1
- package/dist/core/config-schema.d.ts +10 -1
- package/dist/core/config-schema.js +67 -1
- package/dist/core/config.d.ts +15 -0
- package/dist/core/config.js +46 -5
- package/dist/core/file-state.js +56 -24
- package/dist/core/github-copilot/cloud-agent.d.ts +95 -0
- package/dist/core/github-copilot/cloud-agent.js +497 -0
- package/dist/core/global-config.d.ts +16 -0
- package/dist/core/init.d.ts +58 -0
- package/dist/core/init.js +474 -73
- package/dist/core/legacy-cleanup.d.ts +59 -0
- package/dist/core/legacy-cleanup.js +253 -24
- package/dist/core/list.js +23 -16
- package/dist/core/migration.d.ts +73 -1
- package/dist/core/migration.js +360 -11
- package/dist/core/modify/conflict-detector.d.ts +26 -0
- package/dist/core/modify/conflict-detector.js +62 -0
- package/dist/core/modify/dependency-propagator.d.ts +38 -0
- package/dist/core/modify/dependency-propagator.js +103 -0
- package/dist/core/modify/history-tracker.d.ts +34 -0
- package/dist/core/modify/history-tracker.js +114 -0
- package/dist/core/modify/index.d.ts +7 -0
- package/dist/core/modify/index.js +7 -0
- package/dist/core/onboarding-commands.d.ts +30 -0
- package/dist/core/onboarding-commands.js +38 -0
- package/dist/core/openspec-root.js +18 -15
- package/dist/core/parsers/change-parser.d.ts +17 -2
- package/dist/core/parsers/change-parser.js +35 -21
- package/dist/core/parsers/code-fence.d.ts +15 -0
- package/dist/core/parsers/code-fence.js +49 -0
- package/dist/core/parsers/markdown-parser.d.ts +0 -3
- package/dist/core/parsers/markdown-parser.js +7 -60
- package/dist/core/parsers/requirement-blocks.d.ts +29 -0
- package/dist/core/parsers/requirement-blocks.js +150 -31
- package/dist/core/parsers/requirement-text.d.ts +48 -0
- package/dist/core/parsers/requirement-text.js +98 -0
- package/dist/core/parsers/spec-structure.d.ts +1 -1
- package/dist/core/parsers/spec-structure.js +20 -30
- package/dist/core/profile-sync-drift.d.ts +0 -8
- package/dist/core/profile-sync-drift.js +49 -50
- package/dist/core/profiles.d.ts +2 -2
- package/dist/core/profiles.js +2 -2
- package/dist/core/project-config.d.ts +27 -18
- package/dist/core/project-config.js +101 -34
- package/dist/core/references.js +42 -4
- package/dist/core/relationship-health.d.ts +8 -0
- package/dist/core/relationship-health.js +13 -0
- package/dist/core/root-selection.d.ts +9 -6
- package/dist/core/root-selection.js +42 -5
- package/dist/core/schemas/base.schema.js +7 -2
- package/dist/core/shared/allowed-tools.d.ts +12 -0
- package/dist/core/shared/allowed-tools.js +12 -0
- package/dist/core/shared/index.d.ts +1 -0
- package/dist/core/shared/index.js +1 -0
- package/dist/core/shared/skill-content-equivalence.d.ts +7 -0
- package/dist/core/shared/skill-content-equivalence.js +41 -0
- package/dist/core/shared/skill-generation.js +17 -13
- package/dist/core/shared/skill-paths.d.ts +13 -0
- package/dist/core/shared/skill-paths.js +23 -0
- package/dist/core/shared/tool-detection.d.ts +27 -7
- package/dist/core/shared/tool-detection.js +167 -37
- package/dist/core/shared-skill-target.d.ts +16 -0
- package/dist/core/shared-skill-target.js +156 -0
- package/dist/core/specs-apply.d.ts +80 -33
- package/dist/core/specs-apply.js +667 -145
- package/dist/core/store/git.d.ts +13 -0
- package/dist/core/store/git.js +24 -0
- package/dist/core/store/operations.js +20 -0
- package/dist/core/templates/skill-templates.d.ts +3 -2
- package/dist/core/templates/skill-templates.js +3 -2
- package/dist/core/templates/workflows/apply-change.d.ts +10 -0
- package/dist/core/templates/workflows/apply-change.js +186 -323
- package/dist/core/templates/workflows/archive-change.js +387 -260
- package/dist/core/templates/workflows/bulk-archive-change.js +655 -475
- package/dist/core/templates/workflows/continue-change.js +210 -219
- package/dist/core/templates/workflows/explore.js +479 -443
- package/dist/core/templates/workflows/feedback.js +97 -97
- package/dist/core/templates/workflows/ff-change.js +200 -191
- package/dist/core/templates/workflows/modify-change.d.ts +4 -1
- package/dist/core/templates/workflows/modify-change.js +237 -115
- package/dist/core/templates/workflows/new-change.js +127 -134
- package/dist/core/templates/workflows/onboard.js +548 -542
- package/dist/core/templates/workflows/propose.js +273 -217
- package/dist/core/templates/workflows/store-selection.d.ts +1 -1
- package/dist/core/templates/workflows/store-selection.js +1 -1
- package/dist/core/templates/workflows/sync-specs.js +500 -273
- package/dist/core/templates/workflows/update-change.d.ts +10 -0
- package/dist/core/templates/workflows/update-change.js +177 -0
- package/dist/core/templates/workflows/verify-change.js +324 -326
- package/dist/core/update.d.ts +40 -5
- package/dist/core/update.js +411 -96
- package/dist/core/validation/constants.d.ts +4 -1
- package/dist/core/validation/constants.js +4 -1
- package/dist/core/validation/plan-validator.d.ts +8 -0
- package/dist/core/validation/plan-validator.js +45 -0
- package/dist/core/validation/task-numbering.d.ts +16 -0
- package/dist/core/validation/task-numbering.js +57 -0
- package/dist/core/validation/validator.d.ts +27 -3
- package/dist/core/validation/validator.js +337 -48
- package/dist/core/version-check.d.ts +152 -0
- package/dist/core/version-check.js +731 -0
- package/dist/core/view.js +13 -18
- package/dist/prompts/searchable-multi-select.js +1 -1
- package/dist/telemetry/caller-detection.d.ts +27 -0
- package/dist/telemetry/caller-detection.js +85 -0
- package/dist/telemetry/caller-detection.test.d.ts +5 -0
- package/dist/telemetry/config.d.ts +48 -2
- package/dist/telemetry/config.js +113 -11
- package/dist/telemetry/config.test.d.ts +5 -0
- package/dist/telemetry/deduplication.d.ts +35 -0
- package/dist/telemetry/deduplication.js +82 -0
- package/dist/telemetry/deduplication.test.d.ts +5 -0
- package/dist/telemetry/identity.d.ts +62 -22
- package/dist/telemetry/identity.js +147 -102
- package/dist/telemetry/index.d.ts +126 -15
- package/dist/telemetry/index.js +569 -37
- package/dist/telemetry/sanitization.d.ts +40 -0
- package/dist/telemetry/sanitization.js +114 -0
- package/dist/telemetry/sanitization.test.d.ts +5 -0
- package/dist/telemetry/throttling.d.ts +20 -0
- package/dist/telemetry/throttling.js +70 -0
- package/dist/ui/welcome-screen.d.ts +9 -1
- package/dist/ui/welcome-screen.js +91 -38
- package/dist/utils/change-metadata.d.ts +43 -0
- package/dist/utils/change-metadata.js +123 -7
- package/dist/utils/change-utils.d.ts +10 -4
- package/dist/utils/change-utils.js +20 -13
- package/dist/utils/ci.d.ts +12 -0
- package/dist/utils/ci.js +16 -0
- package/dist/utils/command-references.d.ts +92 -6
- package/dist/utils/command-references.js +180 -7
- package/dist/utils/date.d.ts +8 -0
- package/dist/utils/date.js +13 -0
- package/dist/utils/file-system.d.ts +10 -0
- package/dist/utils/file-system.js +70 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -1
- package/dist/utils/interactive.d.ts +23 -0
- package/dist/utils/interactive.js +32 -0
- package/dist/utils/item-discovery.d.ts +19 -0
- package/dist/utils/item-discovery.js +30 -48
- package/dist/utils/shell-detection.d.ts +1 -1
- package/dist/utils/shell-detection.js +64 -11
- package/dist/utils/spec-discovery.d.ts +40 -0
- package/dist/utils/spec-discovery.js +115 -0
- package/dist/utils/task-progress.d.ts +29 -1
- package/dist/utils/task-progress.js +109 -15
- package/package.json +96 -84
- package/schemas/spec-driven/schema.yaml +252 -184
- package/schemas/spec-driven/templates/design.md +19 -19
- package/schemas/spec-driven/templates/plan-template.md +91 -0
- package/schemas/spec-driven/templates/proposal.md +29 -24
- package/schemas/spec-driven/templates/spec.md +11 -8
- package/schemas/spec-driven/templates/tasks.md +9 -9
- package/scripts/postinstall.js +83 -83
- package/dist/core/command-generation/adapters/codex.d.ts +0 -16
- package/dist/core/command-generation/adapters/codex.js +0 -39
- package/dist/core/command-generation/adapters/windsurf.d.ts +0 -14
- package/dist/core/command-generation/adapters/windsurf.js +0 -38
- package/dist/core/comprehension/config.d.ts +0 -20
- package/dist/core/comprehension/config.js +0 -23
- package/dist/core/comprehension/fingerprint.d.ts +0 -14
- package/dist/core/comprehension/fingerprint.js +0 -33
- package/dist/core/comprehension/index.d.ts +0 -57
- package/dist/core/comprehension/index.js +0 -87
- package/dist/core/comprehension/pass-record.d.ts +0 -29
- package/dist/core/comprehension/pass-record.js +0 -64
- package/dist/core/comprehension/stats.d.ts +0 -35
- package/dist/core/comprehension/stats.js +0 -133
- package/dist/core/templates/workflows/comprehension-guidance.d.ts +0 -9
- package/dist/core/templates/workflows/comprehension-guidance.js +0 -71
- package/dist/core/templates/workflows/mcp-guidance.d.ts +0 -13
- package/dist/core/templates/workflows/mcp-guidance.js +0 -131
- package/dist/core/templates/workflows/user-prompt-guidance.d.ts +0 -16
- package/dist/core/templates/workflows/user-prompt-guidance.js +0 -48
- package/dist/telemetry/caller.d.ts +0 -5
- package/dist/telemetry/caller.js +0 -29
- package/dist/telemetry/client.d.ts +0 -27
- package/dist/telemetry/client.js +0 -127
- package/dist/telemetry/command-context.d.ts +0 -13
- package/dist/telemetry/command-context.js +0 -59
- package/dist/telemetry/comprehension.d.ts +0 -44
- package/dist/telemetry/comprehension.js +0 -105
- package/dist/telemetry/content.d.ts +0 -10
- package/dist/telemetry/content.js +0 -56
- package/dist/telemetry/git-stats.d.ts +0 -12
- package/dist/telemetry/git-stats.js +0 -69
- package/dist/telemetry/identify-cache.d.ts +0 -7
- package/dist/telemetry/identify-cache.js +0 -47
- package/dist/telemetry/input.d.ts +0 -17
- package/dist/telemetry/input.js +0 -68
- package/dist/telemetry/marker.d.ts +0 -37
- package/dist/telemetry/marker.js +0 -67
- package/dist/telemetry/workflow.d.ts +0 -85
- package/dist/telemetry/workflow.js +0 -318
- package/schemas/spec-driven/templates/plan.md +0 -19
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { resolveComprehensionConfig } from './config.js';
|
|
2
|
-
import { fingerprintApplyArtifacts } from './fingerprint.js';
|
|
3
|
-
import { buildPassRecord, deleteSessionRecord, isPassValid, readPassRecord, writePassRecord, } from './pass-record.js';
|
|
4
|
-
import { computeSpecStats, OPTIONS_PER_QUESTION, } from './stats.js';
|
|
5
|
-
export { DEFAULT_COMPREHENSION_CONFIG, resolveComprehensionConfig, } from './config.js';
|
|
6
|
-
export { fingerprintApplyArtifacts, fingerprintSpecFiles } from './fingerprint.js';
|
|
7
|
-
export { COMPREHENSION_PASS_FILENAME, COMPREHENSION_SESSION_FILENAME, buildPassRecord, deleteSessionRecord, isPassValid, readPassRecord, writePassRecord, } from './pass-record.js';
|
|
8
|
-
export { computeQuestionAllocation, computeQuestionCount, computeSpecStats, countSpecStats, OPTIONS_PER_QUESTION, } from './stats.js';
|
|
9
|
-
/**
|
|
10
|
-
* Evaluate whether apply is blocked by the comprehension gate.
|
|
11
|
-
*/
|
|
12
|
-
export function checkComprehensionGate(changeDir, specPaths, projectConfig, gateOptions = {}) {
|
|
13
|
-
const config = resolveComprehensionConfig(projectConfig);
|
|
14
|
-
const pendingTaskCount = gateOptions.pendingTaskCount ?? 0;
|
|
15
|
-
const tasksPath = gateOptions.tasksPath ?? null;
|
|
16
|
-
const planPath = gateOptions.planPath ?? null;
|
|
17
|
-
const artifactPresence = gateOptions.artifactPresence ?? {};
|
|
18
|
-
if (!config.enabled) {
|
|
19
|
-
return { active: false, passed: true };
|
|
20
|
-
}
|
|
21
|
-
if (specPaths.length === 0) {
|
|
22
|
-
return { active: false, passed: true };
|
|
23
|
-
}
|
|
24
|
-
const stats = computeSpecStats(specPaths, config, pendingTaskCount, artifactPresence);
|
|
25
|
-
if (stats.requirementCount === 0) {
|
|
26
|
-
return { active: false, passed: true };
|
|
27
|
-
}
|
|
28
|
-
const fingerprint = fingerprintApplyArtifacts({ specPaths, tasksPath, planPath });
|
|
29
|
-
const record = readPassRecord(changeDir);
|
|
30
|
-
const passed = isPassValid(record, fingerprint);
|
|
31
|
-
const info = {
|
|
32
|
-
required: true,
|
|
33
|
-
passed,
|
|
34
|
-
thresholdPercent: config.thresholdPercent,
|
|
35
|
-
questionCount: stats.questionCount,
|
|
36
|
-
questionAllocation: stats.questionAllocation,
|
|
37
|
-
optionsPerQuestion: stats.optionsPerQuestion,
|
|
38
|
-
requirementCount: stats.requirementCount,
|
|
39
|
-
scenarioCount: stats.scenarioCount,
|
|
40
|
-
pendingTaskCount: stats.pendingTaskCount,
|
|
41
|
-
...(record && !passed
|
|
42
|
-
? { bestScorePercent: record.score_percent, attempts: record.attempt }
|
|
43
|
-
: record && passed
|
|
44
|
-
? { attempts: record.attempt }
|
|
45
|
-
: {}),
|
|
46
|
-
};
|
|
47
|
-
return { active: true, passed, info };
|
|
48
|
-
}
|
|
49
|
-
export class ComprehensionPassError extends Error {
|
|
50
|
-
score;
|
|
51
|
-
threshold;
|
|
52
|
-
constructor(message, score, threshold) {
|
|
53
|
-
super(message);
|
|
54
|
-
this.score = score;
|
|
55
|
-
this.threshold = threshold;
|
|
56
|
-
this.name = 'ComprehensionPassError';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Record a comprehension pass after quiz success.
|
|
61
|
-
*/
|
|
62
|
-
export function recordComprehensionPass(input) {
|
|
63
|
-
const config = resolveComprehensionConfig(input.projectConfig);
|
|
64
|
-
if (input.scorePercent < config.thresholdPercent) {
|
|
65
|
-
throw new ComprehensionPassError(`Score ${input.scorePercent}% is below the ${config.thresholdPercent}% threshold required to apply.`, input.scorePercent, config.thresholdPercent);
|
|
66
|
-
}
|
|
67
|
-
const stats = input.questionCount > 0
|
|
68
|
-
? { questionCount: input.questionCount }
|
|
69
|
-
: computeSpecStats(input.specPaths, config, input.pendingTaskCount ?? 0, input.artifactPresence ?? {});
|
|
70
|
-
const fingerprint = fingerprintApplyArtifacts({
|
|
71
|
-
specPaths: input.specPaths,
|
|
72
|
-
tasksPath: input.tasksPath,
|
|
73
|
-
planPath: input.planPath,
|
|
74
|
-
});
|
|
75
|
-
const record = buildPassRecord({
|
|
76
|
-
scorePercent: input.scorePercent,
|
|
77
|
-
thresholdPercent: config.thresholdPercent,
|
|
78
|
-
attempt: input.attempt,
|
|
79
|
-
questionCount: stats.questionCount,
|
|
80
|
-
specFingerprint: fingerprint,
|
|
81
|
-
});
|
|
82
|
-
writePassRecord(input.changeDir, record);
|
|
83
|
-
deleteSessionRecord(input.changeDir);
|
|
84
|
-
return record;
|
|
85
|
-
}
|
|
86
|
-
export { OPTIONS_PER_QUESTION as comprehensionOptionsPerQuestion };
|
|
87
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const COMPREHENSION_PASS_FILENAME = ".comprehension-pass.yaml";
|
|
3
|
-
export declare const COMPREHENSION_SESSION_FILENAME = ".comprehension-session.yaml";
|
|
4
|
-
declare const PassRecordSchema: z.ZodObject<{
|
|
5
|
-
version: z.ZodLiteral<1>;
|
|
6
|
-
passed: z.ZodLiteral<true>;
|
|
7
|
-
score_percent: z.ZodNumber;
|
|
8
|
-
threshold_percent: z.ZodNumber;
|
|
9
|
-
attempt: z.ZodNumber;
|
|
10
|
-
question_count: z.ZodNumber;
|
|
11
|
-
spec_fingerprint: z.ZodString;
|
|
12
|
-
passed_at: z.ZodString;
|
|
13
|
-
}, z.core.$strip>;
|
|
14
|
-
export type ComprehensionPassRecord = z.infer<typeof PassRecordSchema>;
|
|
15
|
-
export declare function passRecordPath(changeDir: string): string;
|
|
16
|
-
export declare function sessionRecordPath(changeDir: string): string;
|
|
17
|
-
export declare function readPassRecord(changeDir: string): ComprehensionPassRecord | null;
|
|
18
|
-
export declare function writePassRecord(changeDir: string, record: ComprehensionPassRecord): void;
|
|
19
|
-
export declare function deleteSessionRecord(changeDir: string): void;
|
|
20
|
-
export declare function isPassValid(record: ComprehensionPassRecord | null, currentFingerprint: string): boolean;
|
|
21
|
-
export declare function buildPassRecord(input: {
|
|
22
|
-
scorePercent: number;
|
|
23
|
-
thresholdPercent: number;
|
|
24
|
-
attempt: number;
|
|
25
|
-
questionCount: number;
|
|
26
|
-
specFingerprint: string;
|
|
27
|
-
}): ComprehensionPassRecord;
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=pass-record.d.ts.map
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
export const COMPREHENSION_PASS_FILENAME = '.comprehension-pass.yaml';
|
|
6
|
-
export const COMPREHENSION_SESSION_FILENAME = '.comprehension-session.yaml';
|
|
7
|
-
const PassRecordSchema = z.object({
|
|
8
|
-
version: z.literal(1),
|
|
9
|
-
passed: z.literal(true),
|
|
10
|
-
score_percent: z.number().int().min(0).max(100),
|
|
11
|
-
threshold_percent: z.number().int().min(0).max(100),
|
|
12
|
-
attempt: z.number().int().positive(),
|
|
13
|
-
question_count: z.number().int().positive(),
|
|
14
|
-
spec_fingerprint: z.string().min(1),
|
|
15
|
-
passed_at: z.string().min(1),
|
|
16
|
-
});
|
|
17
|
-
export function passRecordPath(changeDir) {
|
|
18
|
-
return path.join(changeDir, COMPREHENSION_PASS_FILENAME);
|
|
19
|
-
}
|
|
20
|
-
export function sessionRecordPath(changeDir) {
|
|
21
|
-
return path.join(changeDir, COMPREHENSION_SESSION_FILENAME);
|
|
22
|
-
}
|
|
23
|
-
export function readPassRecord(changeDir) {
|
|
24
|
-
const filePath = passRecordPath(changeDir);
|
|
25
|
-
if (!existsSync(filePath)) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
const parsed = parseYaml(readFileSync(filePath, 'utf-8'));
|
|
30
|
-
const result = PassRecordSchema.safeParse(parsed);
|
|
31
|
-
return result.success ? result.data : null;
|
|
32
|
-
}
|
|
33
|
-
catch {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export function writePassRecord(changeDir, record) {
|
|
38
|
-
writeFileSync(passRecordPath(changeDir), stringifyYaml(record), 'utf-8');
|
|
39
|
-
}
|
|
40
|
-
export function deleteSessionRecord(changeDir) {
|
|
41
|
-
const filePath = sessionRecordPath(changeDir);
|
|
42
|
-
if (existsSync(filePath)) {
|
|
43
|
-
unlinkSync(filePath);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export function isPassValid(record, currentFingerprint) {
|
|
47
|
-
if (!record?.passed) {
|
|
48
|
-
return false;
|
|
49
|
-
}
|
|
50
|
-
return record.spec_fingerprint === currentFingerprint;
|
|
51
|
-
}
|
|
52
|
-
export function buildPassRecord(input) {
|
|
53
|
-
return {
|
|
54
|
-
version: 1,
|
|
55
|
-
passed: true,
|
|
56
|
-
score_percent: input.scorePercent,
|
|
57
|
-
threshold_percent: input.thresholdPercent,
|
|
58
|
-
attempt: input.attempt,
|
|
59
|
-
question_count: input.questionCount,
|
|
60
|
-
spec_fingerprint: input.specFingerprint,
|
|
61
|
-
passed_at: new Date().toISOString(),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
//# sourceMappingURL=pass-record.js.map
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import type { ComprehensionConfig } from './config.js';
|
|
2
|
-
export declare const OPTIONS_PER_QUESTION = 3;
|
|
3
|
-
export type QuestionCategory = 'plan' | 'specs' | 'design' | 'proposal' | 'tasks';
|
|
4
|
-
export type QuestionAllocation = Partial<Record<QuestionCategory, number>>;
|
|
5
|
-
export interface ArtifactPresence {
|
|
6
|
-
hasPlan?: boolean;
|
|
7
|
-
hasProposal?: boolean;
|
|
8
|
-
hasDesign?: boolean;
|
|
9
|
-
hasSpecs?: boolean;
|
|
10
|
-
hasTasks?: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface SpecStats {
|
|
13
|
-
requirementCount: number;
|
|
14
|
-
scenarioCount: number;
|
|
15
|
-
pendingTaskCount: number;
|
|
16
|
-
questionCount: number;
|
|
17
|
-
questionAllocation: QuestionAllocation;
|
|
18
|
-
optionsPerQuestion: number;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Distribute quiz questions across artifact categories.
|
|
22
|
-
* When plan exists, plan receives ceil(total/2) — strictly more than any other category.
|
|
23
|
-
*/
|
|
24
|
-
export declare function computeQuestionAllocation(total: number, presence: ArtifactPresence): QuestionAllocation;
|
|
25
|
-
/**
|
|
26
|
-
* Count requirements and scenarios across delta spec files.
|
|
27
|
-
*/
|
|
28
|
-
export declare function countSpecStats(specPaths: string[]): Pick<SpecStats, 'requirementCount' | 'scenarioCount'>;
|
|
29
|
-
/**
|
|
30
|
-
* Target quiz length from spec and task size:
|
|
31
|
-
* clamp(min, max, round(req * 0.6 + scenarios * 0.15 + pendingTasks * 0.15)).
|
|
32
|
-
*/
|
|
33
|
-
export declare function computeQuestionCount(requirementCount: number, scenarioCount: number, pendingTaskCount: number, config: Pick<ComprehensionConfig, 'minQuestions' | 'maxQuestions'>): number;
|
|
34
|
-
export declare function computeSpecStats(specPaths: string[], config: Pick<ComprehensionConfig, 'minQuestions' | 'maxQuestions'>, pendingTaskCount?: number, presence?: ArtifactPresence): SpecStats;
|
|
35
|
-
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { parseDeltaSpec } from '../parsers/requirement-blocks.js';
|
|
3
|
-
const SCENARIO_HEADER_REGEX = /^####\s*Scenario:/gim;
|
|
4
|
-
export const OPTIONS_PER_QUESTION = 3;
|
|
5
|
-
const NON_PLAN_PRIORITY = ['specs', 'design', 'proposal', 'tasks'];
|
|
6
|
-
function isCategoryPresent(category, presence) {
|
|
7
|
-
switch (category) {
|
|
8
|
-
case 'plan':
|
|
9
|
-
return presence.hasPlan === true;
|
|
10
|
-
case 'specs':
|
|
11
|
-
return presence.hasSpecs === true;
|
|
12
|
-
case 'design':
|
|
13
|
-
return presence.hasDesign === true;
|
|
14
|
-
case 'proposal':
|
|
15
|
-
return presence.hasProposal === true;
|
|
16
|
-
case 'tasks':
|
|
17
|
-
return presence.hasTasks === true;
|
|
18
|
-
default:
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function sumAllocation(allocation) {
|
|
23
|
-
return Object.values(allocation).reduce((sum, n) => sum + (n ?? 0), 0);
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Distribute quiz questions across artifact categories.
|
|
27
|
-
* When plan exists, plan receives ceil(total/2) — strictly more than any other category.
|
|
28
|
-
*/
|
|
29
|
-
export function computeQuestionAllocation(total, presence) {
|
|
30
|
-
if (total <= 0) {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
if (presence.hasPlan) {
|
|
34
|
-
const allocation = {};
|
|
35
|
-
const planQuota = Math.ceil(total / 2);
|
|
36
|
-
allocation.plan = planQuota;
|
|
37
|
-
let remainder = total - planQuota;
|
|
38
|
-
for (const category of NON_PLAN_PRIORITY) {
|
|
39
|
-
if (remainder <= 0) {
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
if (!isCategoryPresent(category, presence)) {
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
allocation[category] = (allocation[category] ?? 0) + 1;
|
|
46
|
-
remainder--;
|
|
47
|
-
}
|
|
48
|
-
const presentOthers = NON_PLAN_PRIORITY.filter((category) => isCategoryPresent(category, presence));
|
|
49
|
-
let index = 0;
|
|
50
|
-
while (remainder > 0 && presentOthers.length > 0) {
|
|
51
|
-
const category = presentOthers[index % presentOthers.length];
|
|
52
|
-
allocation[category] = (allocation[category] ?? 0) + 1;
|
|
53
|
-
remainder--;
|
|
54
|
-
index++;
|
|
55
|
-
}
|
|
56
|
-
return allocation;
|
|
57
|
-
}
|
|
58
|
-
return computeQuestionAllocationEven(total, presence);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Even split when plan is absent: at least one per present category, extras specs-first.
|
|
62
|
-
*/
|
|
63
|
-
function computeQuestionAllocationEven(total, presence) {
|
|
64
|
-
const present = NON_PLAN_PRIORITY.filter((category) => isCategoryPresent(category, presence));
|
|
65
|
-
if (present.length === 0) {
|
|
66
|
-
return {};
|
|
67
|
-
}
|
|
68
|
-
const allocation = {};
|
|
69
|
-
let assigned = 0;
|
|
70
|
-
for (const category of present) {
|
|
71
|
-
if (assigned >= total) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
allocation[category] = 1;
|
|
75
|
-
assigned++;
|
|
76
|
-
}
|
|
77
|
-
let remainder = total - assigned;
|
|
78
|
-
let index = 0;
|
|
79
|
-
while (remainder > 0) {
|
|
80
|
-
const category = present[index % present.length];
|
|
81
|
-
allocation[category] = (allocation[category] ?? 0) + 1;
|
|
82
|
-
remainder--;
|
|
83
|
-
index++;
|
|
84
|
-
}
|
|
85
|
-
return allocation;
|
|
86
|
-
}
|
|
87
|
-
function countScenariosInBlock(raw) {
|
|
88
|
-
const matches = raw.match(SCENARIO_HEADER_REGEX);
|
|
89
|
-
return matches?.length ?? 0;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Count requirements and scenarios across delta spec files.
|
|
93
|
-
*/
|
|
94
|
-
export function countSpecStats(specPaths) {
|
|
95
|
-
let requirementCount = 0;
|
|
96
|
-
let scenarioCount = 0;
|
|
97
|
-
for (const specPath of specPaths) {
|
|
98
|
-
const content = readFileSync(specPath, 'utf-8');
|
|
99
|
-
const plan = parseDeltaSpec(content);
|
|
100
|
-
const blocks = [...plan.added, ...plan.modified];
|
|
101
|
-
requirementCount += blocks.length;
|
|
102
|
-
for (const block of blocks) {
|
|
103
|
-
scenarioCount += countScenariosInBlock(block.raw);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return { requirementCount, scenarioCount };
|
|
107
|
-
}
|
|
108
|
-
function clamp(min, max, value) {
|
|
109
|
-
return Math.min(max, Math.max(min, value));
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Target quiz length from spec and task size:
|
|
113
|
-
* clamp(min, max, round(req * 0.6 + scenarios * 0.15 + pendingTasks * 0.15)).
|
|
114
|
-
*/
|
|
115
|
-
export function computeQuestionCount(requirementCount, scenarioCount, pendingTaskCount, config) {
|
|
116
|
-
const raw = Math.round(requirementCount * 0.6 + scenarioCount * 0.15 + pendingTaskCount * 0.15);
|
|
117
|
-
return clamp(config.minQuestions, config.maxQuestions, raw);
|
|
118
|
-
}
|
|
119
|
-
export function computeSpecStats(specPaths, config, pendingTaskCount = 0, presence = {}) {
|
|
120
|
-
const { requirementCount, scenarioCount } = countSpecStats(specPaths);
|
|
121
|
-
const questionCount = computeQuestionCount(requirementCount, scenarioCount, pendingTaskCount, config);
|
|
122
|
-
const questionAllocation = computeQuestionAllocation(questionCount, presence);
|
|
123
|
-
const allocationTotal = sumAllocation(questionAllocation);
|
|
124
|
-
return {
|
|
125
|
-
requirementCount,
|
|
126
|
-
scenarioCount,
|
|
127
|
-
pendingTaskCount,
|
|
128
|
-
questionCount: allocationTotal > 0 ? allocationTotal : questionCount,
|
|
129
|
-
questionAllocation,
|
|
130
|
-
optionsPerQuestion: OPTIONS_PER_QUESTION,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
//# sourceMappingURL=stats.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comprehension quiz guidance for apply workflows.
|
|
3
|
-
*
|
|
4
|
-
* Interpolated into apply skill and slash command templates so agents run
|
|
5
|
-
* a spec comprehension gate before implementation.
|
|
6
|
-
*/
|
|
7
|
-
export declare const COMPREHENSION_QUIZ_GUIDANCE = "4. **Comprehension quiz (required before implementation)**\n\n After `openspec instructions apply --change \"<name>\" --json`, check comprehension status:\n\n - If `missingComprehension` is true OR `comprehension.required && !comprehension.passed`:\n - Do NOT edit application source code or mark task checkboxes yet\n - Read `contextFiles.proposal`, `contextFiles.design`, `contextFiles.specs`, `contextFiles.plan`, and `contextFiles.tasks` (or the `tasks` array in apply JSON)\n - Use `comprehension.questionCount` and `comprehension.questionAllocation` from the JSON\n\n **Generate questions**\n - Create exactly `comprehension.questionCount` multiple-choice questions\n - **Follow `comprehension.questionAllocation`** \u2014 generate the exact count per category (e.g. plan\u00D74, specs\u00D71); do not invent your own split\n - Each question maps to one artifact category:\n - **Proposal**: motivation, scope, or impact from `proposal.md`\n - **Design**: decisions, trade-offs, or approach from `design.md`\n - **Specs**: a `### Requirement:` or `#### Scenario:` from delta specs\n - **Plan**: code map, file targets, test plan, sequencing, or alignment with design from `plan.md`\n - **Tasks**: conceptual understanding of the implementation approach from pending (unchecked) tasks\n - Do NOT use completed tasks as question sources\n - Each question: **3 options** (`comprehension.optionsPerQuestion`, default 3) \u2014 1 correct from source substance, 2 plausible distractors from other proposal/design/spec/plan/task substance in the change\n\n **Plan question quality**\n - Test code map, file targets, test plan, sequencing, or alignment with design\n - **Forbidden**: section numbers, verbatim headings, trivia answerable without reading plan substance\n\n **Task question quality**\n - Test scope, approach, dependencies, sequencing rationale, or alignment with proposal/design/plan\n - **Forbidden**: task numbers, checklist order, \"which task says X verbatim\", or answers identifiable only by task index or checkbox position\n - Good: \"What is the primary file where quiz rules are centralized?\" (answer from task substance)\n - Bad: \"Which task number updates `comprehension-guidance.ts`?\" or \"What is the exact text of task 2.1?\"\n\n **Present and grade**\n - Present each question in chat with labeled options (A/B/C/D or 1\u20134)\n - Ask ONE question at a time; after each, STOP and wait for the user's answer before the next question\n - NEVER select answers yourself, infer what the user would pick, or call `--record-comprehension-pass` until the user has answered every question\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.\n - Grade: `score_percent = round(correct / question_count * 100)`\n - Pass when `score_percent >= comprehension.thresholdPercent` (default 80)\n\n **On failure (score below threshold)**\n - Announce score and that a new quiz is required\n - Update `.comprehension-session.yaml` in the change dir with `used_sources` from this attempt\n - Generate a NEW question set using different proposal/design/spec/plan/task sources (avoid `used_sources`)\n - Retry until pass\n\n **On pass**\n ```bash\n openspec instructions apply --change \"<name>\" --record-comprehension-pass --score <score> --attempt <n> --question-count <count> --json\n ```\n - Re-run `openspec instructions apply --change \"<name>\" --json`\n - Confirm `state` is `\"ready\"` and `comprehension.passed` is true before continuing\n\n **Output template**\n ```\n ## Applying: <change-name> \u2014 comprehension check\n\n plan\u00D7N, specs\u00D7N, design\u00D7N, proposal\u00D7N, tasks\u00D7N \u2192 <questionCount> questions (3 options each)\n\n Question 1/N: ...\n ...\n \u2713 Comprehension passed (<score>%, attempt <n>)\n ```\n\n Then continue to step 5 (show progress) and implementation.";
|
|
8
|
-
export declare const COMPREHENSION_APPLY_GUARDRAIL = "- NEVER implement code or mark tasks while `missingComprehension` is true\n- NEVER skip the comprehension quiz when the apply JSON requires it\n- NEVER answer comprehension quiz questions yourself \u2014 the human developer must answer every question\n- NEVER call `--record-comprehension-pass` until the user has answered every question\n- If the user asks to skip the quiz, refuse and explain they must pass or set comprehension.enabled: false in openspec/config.yaml";
|
|
9
|
-
//# sourceMappingURL=comprehension-guidance.d.ts.map
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comprehension quiz guidance for apply workflows.
|
|
3
|
-
*
|
|
4
|
-
* Interpolated into apply skill and slash command templates so agents run
|
|
5
|
-
* a spec comprehension gate before implementation.
|
|
6
|
-
*/
|
|
7
|
-
import { COMPREHENSION_PRESENT_AND_GRADE } from './user-prompt-guidance.js';
|
|
8
|
-
export const COMPREHENSION_QUIZ_GUIDANCE = `4. **Comprehension quiz (required before implementation)**
|
|
9
|
-
|
|
10
|
-
After \`openspec instructions apply --change "<name>" --json\`, check comprehension status:
|
|
11
|
-
|
|
12
|
-
- If \`missingComprehension\` is true OR \`comprehension.required && !comprehension.passed\`:
|
|
13
|
-
- Do NOT edit application source code or mark task checkboxes yet
|
|
14
|
-
- Read \`contextFiles.proposal\`, \`contextFiles.design\`, \`contextFiles.specs\`, \`contextFiles.plan\`, and \`contextFiles.tasks\` (or the \`tasks\` array in apply JSON)
|
|
15
|
-
- Use \`comprehension.questionCount\` and \`comprehension.questionAllocation\` from the JSON
|
|
16
|
-
|
|
17
|
-
**Generate questions**
|
|
18
|
-
- Create exactly \`comprehension.questionCount\` multiple-choice questions
|
|
19
|
-
- **Follow \`comprehension.questionAllocation\`** — generate the exact count per category (e.g. plan×4, specs×1); do not invent your own split
|
|
20
|
-
- Each question maps to one artifact category:
|
|
21
|
-
- **Proposal**: motivation, scope, or impact from \`proposal.md\`
|
|
22
|
-
- **Design**: decisions, trade-offs, or approach from \`design.md\`
|
|
23
|
-
- **Specs**: a \`### Requirement:\` or \`#### Scenario:\` from delta specs
|
|
24
|
-
- **Plan**: code map, file targets, test plan, sequencing, or alignment with design from \`plan.md\`
|
|
25
|
-
- **Tasks**: conceptual understanding of the implementation approach from pending (unchecked) tasks
|
|
26
|
-
- Do NOT use completed tasks as question sources
|
|
27
|
-
- Each question: **3 options** (\`comprehension.optionsPerQuestion\`, default 3) — 1 correct from source substance, 2 plausible distractors from other proposal/design/spec/plan/task substance in the change
|
|
28
|
-
|
|
29
|
-
**Plan question quality**
|
|
30
|
-
- Test code map, file targets, test plan, sequencing, or alignment with design
|
|
31
|
-
- **Forbidden**: section numbers, verbatim headings, trivia answerable without reading plan substance
|
|
32
|
-
|
|
33
|
-
**Task question quality**
|
|
34
|
-
- Test scope, approach, dependencies, sequencing rationale, or alignment with proposal/design/plan
|
|
35
|
-
- **Forbidden**: task numbers, checklist order, "which task says X verbatim", or answers identifiable only by task index or checkbox position
|
|
36
|
-
- Good: "What is the primary file where quiz rules are centralized?" (answer from task substance)
|
|
37
|
-
- Bad: "Which task number updates \`comprehension-guidance.ts\`?" or "What is the exact text of task 2.1?"
|
|
38
|
-
|
|
39
|
-
${COMPREHENSION_PRESENT_AND_GRADE}
|
|
40
|
-
|
|
41
|
-
**On failure (score below threshold)**
|
|
42
|
-
- Announce score and that a new quiz is required
|
|
43
|
-
- Update \`.comprehension-session.yaml\` in the change dir with \`used_sources\` from this attempt
|
|
44
|
-
- Generate a NEW question set using different proposal/design/spec/plan/task sources (avoid \`used_sources\`)
|
|
45
|
-
- Retry until pass
|
|
46
|
-
|
|
47
|
-
**On pass**
|
|
48
|
-
\`\`\`bash
|
|
49
|
-
openspec instructions apply --change "<name>" --record-comprehension-pass --score <score> --attempt <n> --question-count <count> --json
|
|
50
|
-
\`\`\`
|
|
51
|
-
- Re-run \`openspec instructions apply --change "<name>" --json\`
|
|
52
|
-
- Confirm \`state\` is \`"ready"\` and \`comprehension.passed\` is true before continuing
|
|
53
|
-
|
|
54
|
-
**Output template**
|
|
55
|
-
\`\`\`
|
|
56
|
-
## Applying: <change-name> — comprehension check
|
|
57
|
-
|
|
58
|
-
plan×N, specs×N, design×N, proposal×N, tasks×N → <questionCount> questions (3 options each)
|
|
59
|
-
|
|
60
|
-
Question 1/N: ...
|
|
61
|
-
...
|
|
62
|
-
✓ Comprehension passed (<score>%, attempt <n>)
|
|
63
|
-
\`\`\`
|
|
64
|
-
|
|
65
|
-
Then continue to step 5 (show progress) and implementation.`;
|
|
66
|
-
export const COMPREHENSION_APPLY_GUARDRAIL = `- NEVER implement code or mark tasks while \`missingComprehension\` is true
|
|
67
|
-
- NEVER skip the comprehension quiz when the apply JSON requires it
|
|
68
|
-
- NEVER answer comprehension quiz questions yourself — the human developer must answer every question
|
|
69
|
-
- NEVER call \`--record-comprehension-pass\` until the user has answered every question
|
|
70
|
-
- If the user asks to skip the quiz, refuse and explain they must pass or set comprehension.enabled: false in openspec/config.yaml`;
|
|
71
|
-
//# sourceMappingURL=comprehension-guidance.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared MCP guidance for Codewalla workflow templates.
|
|
3
|
-
*
|
|
4
|
-
* Interpolated into propose, apply, and verify workflows so generated
|
|
5
|
-
* skills and slash commands consistently teach when to use Atlassian, Context7,
|
|
6
|
-
* and Playwright MCP tools.
|
|
7
|
-
*/
|
|
8
|
-
export declare const ATLASSIAN_ENRICHMENT_GUIDANCE = "3.5. **Enrich from Jira (if ticket key available)**\n\n Scan the change name, proposal.md, and design.md for a Jira issue key\n (pattern: one or more capital letters, a dash, one or more digits \u2014 e.g., CW-123, PROJ-456).\n\n If a ticket key is found, use the **Atlassian MCP**:\n\n **a. Fetch the issue**\n - Retrieve: summary, description, issue type, status, labels\n - Extract any \"Acceptance Criteria\" section from the description\n - Note the assignee and reporter\n\n **b. Walk the parent hierarchy**\n - If the issue has a parent (sub-task \u2192 story, or story \u2192 epic):\n - Fetch the parent ticket for business goal context\n - If parent has a parent (epic), fetch that too for initiative framing\n - Note the full path: Initiative \u2192 Epic \u2192 Story \u2192 Sub-task\n\n **c. Fetch recent comments**\n - Get comments, ordered by date\n - Look for scope reduction (\"out of scope\", \"defer X\"), changed approach,\n blocker resolutions, or QA/review feedback added after planning\n\n **d. Cross-check against tasks.md**\n - For each acceptance criterion in Jira: verify at least one task covers it\n - If an AC has no corresponding task \u2192 add it to the flagged list\n - For any comment that changed scope post-planning \u2192 note the discrepancy\n\n **Output:** Print a \"Jira Context\" section showing:\n - Ticket key + summary, type, status\n - Parent chain (if any)\n - ACs: covered \u2713 / not covered \u2717\n - Scope-change comments (if any, with date)\n - \"Proceeding with implementation\" or \"\u26A0 Pausing \u2014 scope mismatch found, confirm before continuing\"\n\n **If no ticket key found or Atlassian MCP unavailable:** Skip silently and continue.";
|
|
9
|
-
export declare const ATLASSIAN_PROPOSE_GUIDANCE = "0. **Import from Jira (if a ticket key is provided)**\n\n If the user's input contains or is a Jira issue key (e.g., \"CW-1234\" or \"CW-1234 add dark mode\"):\n\n Use the **Atlassian MCP** to fetch the issue:\n - summary \u2192 becomes the change name candidate (kebab-case it)\n - description \u2192 seed for proposal.md \"Why\" and \"What Changes\" sections\n - acceptance criteria \u2192 seed for specs artifact requirements\n - parent epic \u2192 context for the \"Impact\" section of the proposal\n\n Walk the parent chain:\n - Fetch the epic (or story parent) for business-level framing\n - Include the epic goal as opening context in the proposal\n\n After fetching, proceed to step 1 using the ticket data as pre-filled input.\n Tell the user: \"Found CW-1234: '<summary>'. Creating change from Jira ticket.\"\n\n **Naming conventions** (Jira tracks work; specs track behavior):\n\n - **Change name**: kebab-case summary; optionally prefix with lowercase ticket key\n (e.g., `cw-1234-add-dark-mode`). Never use the ticket key alone as the change name.\n - **Capabilities** (proposal + delta specs): pick domain names from existing\n `openspec/specs/` or derive from behavior (`ui`, `auth`). **Do NOT** name\n capabilities or spec folders after the Jira key.\n - **Acceptance criteria**: map each AC to requirements/scenarios inside the\n appropriate capability spec\u2014not to a ticket-named spec file.\n - **Traceability**: record ticket key(s) in proposal **Impact**\n (e.g., `Jira: CW-1234` or `Jira: CW-100 (epic), CW-1234 (story)`).\n - **Follow-up work**: when continuing or splitting ticket work, create a new change\n folder with a distinct name; reference the same or related tickets in Impact.\n Do not reuse archived change folders or ticket-key spec folders.\n\n **If no ticket key:** proceed normally from step 1.";
|
|
10
|
-
export declare const CONTEXT7_LOOKUP_GUIDANCE = " **Before implementing each task \u2014 library check:**\n\n If the task description references a specific library, framework, or package\n (e.g., \"implement with Prisma\", \"add React Query cache\", \"use Drizzle ORM transactions\",\n \"migrate to Next.js App Router\", \"use tRPC v11 procedure\"):\n\n 1. Call `resolve-library-id` (Context7 MCP) with the library name to get its Context7 ID\n 2. Call `query-docs` with the Context7 ID and the specific question from the task\n \u2014 e.g., \"How to use transactions with Drizzle ORM 0.38?\"\n 3. Use the returned documentation to guide the implementation\n\n **When to trigger this check:**\n - Task mentions a package by name\n - Task uses version-specific language (\"v5 API\", \"new hook syntax\")\n - Task involves migration between library versions\n - The codebase's package.json shows a recently updated dependency relevant to the task\n\n **When to skip:**\n - Task is purely business logic (no library API involved)\n - You already fetched docs for this library in a previous task this session\n (reuse the earlier result, don't call again)\n\n **Cap:** Do not call Context7 more than 3 times per apply session.";
|
|
11
|
-
export declare const PLAYWRIGHT_APPLY_GUARDRAIL = "- Do NOT run Playwright or browser tests during apply. If the user explicitly asks to also \"run tests\", \"verify UI\", or \"check in browser\" in the same message, complete all tasks first, then invoke openspec-verify-change (or `/opsx:verify`) to handle browser verification \u2014 do not do it inline during apply";
|
|
12
|
-
export declare const PLAYWRIGHT_VERIFY_GUIDANCE = "8. **Browser verification (Playwright)**\n\n After codebase analysis (steps 5\u20137), assess if the change touches UI or web pages:\n - proposal.md or tasks.md mentions pages, components, screens, UI, CSS, visual, layout\n\n **If yes, use the Playwright MCP:**\n\n **a. Check for a running dev server**\n - Scan package.json `scripts` for: `dev`, `start`, `preview`, `serve`\n - Check if localhost is reachable (common ports: 3000, 3001, 5173, 8080)\n - If a URL is available, announce it. If not, note \"No dev server detected \u2014 skipping visual verification.\"\n\n **b. If dev server is reachable:**\n - Use `browser_navigate` to open the affected page(s) identified from the change\n - Use `browser_take_screenshot` to capture the current visual state\n - Use `browser_snapshot` to get the accessibility tree and verify key elements\n - Use `browser_console_messages` to check for JS errors introduced by this change\n - If network requests are relevant: `browser_network_requests` to spot regressions\n\n **c. Playwright test files**\n Search the project for:\n - `**/*.spec.ts`, `**/*.e2e.ts`, `**/playwright/**/*.ts`, `**/e2e/**/*.ts`\n If test files related to the changed pages/components are found:\n - List them\n - If the user asks you to run them, execute and report pass/fail inline\n\n **If no dev server is reachable:**\n Add a SUGGESTION to the report: \"Start dev server and re-run /opsx:verify for visual confirmation.\"\n\n Include browser results in the verification report (step 9).";
|
|
13
|
-
//# sourceMappingURL=mcp-guidance.d.ts.map
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared MCP guidance for Codewalla workflow templates.
|
|
3
|
-
*
|
|
4
|
-
* Interpolated into propose, apply, and verify workflows so generated
|
|
5
|
-
* skills and slash commands consistently teach when to use Atlassian, Context7,
|
|
6
|
-
* and Playwright MCP tools.
|
|
7
|
-
*/
|
|
8
|
-
export const ATLASSIAN_ENRICHMENT_GUIDANCE = `3.5. **Enrich from Jira (if ticket key available)**
|
|
9
|
-
|
|
10
|
-
Scan the change name, proposal.md, and design.md for a Jira issue key
|
|
11
|
-
(pattern: one or more capital letters, a dash, one or more digits — e.g., CW-123, PROJ-456).
|
|
12
|
-
|
|
13
|
-
If a ticket key is found, use the **Atlassian MCP**:
|
|
14
|
-
|
|
15
|
-
**a. Fetch the issue**
|
|
16
|
-
- Retrieve: summary, description, issue type, status, labels
|
|
17
|
-
- Extract any "Acceptance Criteria" section from the description
|
|
18
|
-
- Note the assignee and reporter
|
|
19
|
-
|
|
20
|
-
**b. Walk the parent hierarchy**
|
|
21
|
-
- If the issue has a parent (sub-task → story, or story → epic):
|
|
22
|
-
- Fetch the parent ticket for business goal context
|
|
23
|
-
- If parent has a parent (epic), fetch that too for initiative framing
|
|
24
|
-
- Note the full path: Initiative → Epic → Story → Sub-task
|
|
25
|
-
|
|
26
|
-
**c. Fetch recent comments**
|
|
27
|
-
- Get comments, ordered by date
|
|
28
|
-
- Look for scope reduction ("out of scope", "defer X"), changed approach,
|
|
29
|
-
blocker resolutions, or QA/review feedback added after planning
|
|
30
|
-
|
|
31
|
-
**d. Cross-check against tasks.md**
|
|
32
|
-
- For each acceptance criterion in Jira: verify at least one task covers it
|
|
33
|
-
- If an AC has no corresponding task → add it to the flagged list
|
|
34
|
-
- For any comment that changed scope post-planning → note the discrepancy
|
|
35
|
-
|
|
36
|
-
**Output:** Print a "Jira Context" section showing:
|
|
37
|
-
- Ticket key + summary, type, status
|
|
38
|
-
- Parent chain (if any)
|
|
39
|
-
- ACs: covered ✓ / not covered ✗
|
|
40
|
-
- Scope-change comments (if any, with date)
|
|
41
|
-
- "Proceeding with implementation" or "⚠ Pausing — scope mismatch found, confirm before continuing"
|
|
42
|
-
|
|
43
|
-
**If no ticket key found or Atlassian MCP unavailable:** Skip silently and continue.`;
|
|
44
|
-
export const ATLASSIAN_PROPOSE_GUIDANCE = `0. **Import from Jira (if a ticket key is provided)**
|
|
45
|
-
|
|
46
|
-
If the user's input contains or is a Jira issue key (e.g., "CW-1234" or "CW-1234 add dark mode"):
|
|
47
|
-
|
|
48
|
-
Use the **Atlassian MCP** to fetch the issue:
|
|
49
|
-
- summary → becomes the change name candidate (kebab-case it)
|
|
50
|
-
- description → seed for proposal.md "Why" and "What Changes" sections
|
|
51
|
-
- acceptance criteria → seed for specs artifact requirements
|
|
52
|
-
- parent epic → context for the "Impact" section of the proposal
|
|
53
|
-
|
|
54
|
-
Walk the parent chain:
|
|
55
|
-
- Fetch the epic (or story parent) for business-level framing
|
|
56
|
-
- Include the epic goal as opening context in the proposal
|
|
57
|
-
|
|
58
|
-
After fetching, proceed to step 1 using the ticket data as pre-filled input.
|
|
59
|
-
Tell the user: "Found CW-1234: '<summary>'. Creating change from Jira ticket."
|
|
60
|
-
|
|
61
|
-
**Naming conventions** (Jira tracks work; specs track behavior):
|
|
62
|
-
|
|
63
|
-
- **Change name**: kebab-case summary; optionally prefix with lowercase ticket key
|
|
64
|
-
(e.g., \`cw-1234-add-dark-mode\`). Never use the ticket key alone as the change name.
|
|
65
|
-
- **Capabilities** (proposal + delta specs): pick domain names from existing
|
|
66
|
-
\`openspec/specs/\` or derive from behavior (\`ui\`, \`auth\`). **Do NOT** name
|
|
67
|
-
capabilities or spec folders after the Jira key.
|
|
68
|
-
- **Acceptance criteria**: map each AC to requirements/scenarios inside the
|
|
69
|
-
appropriate capability spec—not to a ticket-named spec file.
|
|
70
|
-
- **Traceability**: record ticket key(s) in proposal **Impact**
|
|
71
|
-
(e.g., \`Jira: CW-1234\` or \`Jira: CW-100 (epic), CW-1234 (story)\`).
|
|
72
|
-
- **Follow-up work**: when continuing or splitting ticket work, create a new change
|
|
73
|
-
folder with a distinct name; reference the same or related tickets in Impact.
|
|
74
|
-
Do not reuse archived change folders or ticket-key spec folders.
|
|
75
|
-
|
|
76
|
-
**If no ticket key:** proceed normally from step 1.`;
|
|
77
|
-
export const CONTEXT7_LOOKUP_GUIDANCE = ` **Before implementing each task — library check:**
|
|
78
|
-
|
|
79
|
-
If the task description references a specific library, framework, or package
|
|
80
|
-
(e.g., "implement with Prisma", "add React Query cache", "use Drizzle ORM transactions",
|
|
81
|
-
"migrate to Next.js App Router", "use tRPC v11 procedure"):
|
|
82
|
-
|
|
83
|
-
1. Call \`resolve-library-id\` (Context7 MCP) with the library name to get its Context7 ID
|
|
84
|
-
2. Call \`query-docs\` with the Context7 ID and the specific question from the task
|
|
85
|
-
— e.g., "How to use transactions with Drizzle ORM 0.38?"
|
|
86
|
-
3. Use the returned documentation to guide the implementation
|
|
87
|
-
|
|
88
|
-
**When to trigger this check:**
|
|
89
|
-
- Task mentions a package by name
|
|
90
|
-
- Task uses version-specific language ("v5 API", "new hook syntax")
|
|
91
|
-
- Task involves migration between library versions
|
|
92
|
-
- The codebase's package.json shows a recently updated dependency relevant to the task
|
|
93
|
-
|
|
94
|
-
**When to skip:**
|
|
95
|
-
- Task is purely business logic (no library API involved)
|
|
96
|
-
- You already fetched docs for this library in a previous task this session
|
|
97
|
-
(reuse the earlier result, don't call again)
|
|
98
|
-
|
|
99
|
-
**Cap:** Do not call Context7 more than 3 times per apply session.`;
|
|
100
|
-
export const PLAYWRIGHT_APPLY_GUARDRAIL = `- Do NOT run Playwright or browser tests during apply. If the user explicitly asks to also "run tests", "verify UI", or "check in browser" in the same message, complete all tasks first, then invoke openspec-verify-change (or \`/opsx:verify\`) to handle browser verification — do not do it inline during apply`;
|
|
101
|
-
export const PLAYWRIGHT_VERIFY_GUIDANCE = `8. **Browser verification (Playwright)**
|
|
102
|
-
|
|
103
|
-
After codebase analysis (steps 5–7), assess if the change touches UI or web pages:
|
|
104
|
-
- proposal.md or tasks.md mentions pages, components, screens, UI, CSS, visual, layout
|
|
105
|
-
|
|
106
|
-
**If yes, use the Playwright MCP:**
|
|
107
|
-
|
|
108
|
-
**a. Check for a running dev server**
|
|
109
|
-
- Scan package.json \`scripts\` for: \`dev\`, \`start\`, \`preview\`, \`serve\`
|
|
110
|
-
- Check if localhost is reachable (common ports: 3000, 3001, 5173, 8080)
|
|
111
|
-
- If a URL is available, announce it. If not, note "No dev server detected — skipping visual verification."
|
|
112
|
-
|
|
113
|
-
**b. If dev server is reachable:**
|
|
114
|
-
- Use \`browser_navigate\` to open the affected page(s) identified from the change
|
|
115
|
-
- Use \`browser_take_screenshot\` to capture the current visual state
|
|
116
|
-
- Use \`browser_snapshot\` to get the accessibility tree and verify key elements
|
|
117
|
-
- Use \`browser_console_messages\` to check for JS errors introduced by this change
|
|
118
|
-
- If network requests are relevant: \`browser_network_requests\` to spot regressions
|
|
119
|
-
|
|
120
|
-
**c. Playwright test files**
|
|
121
|
-
Search the project for:
|
|
122
|
-
- \`**/*.spec.ts\`, \`**/*.e2e.ts\`, \`**/playwright/**/*.ts\`, \`**/e2e/**/*.ts\`
|
|
123
|
-
If test files related to the changed pages/components are found:
|
|
124
|
-
- List them
|
|
125
|
-
- If the user asks you to run them, execute and report pass/fail inline
|
|
126
|
-
|
|
127
|
-
**If no dev server is reachable:**
|
|
128
|
-
Add a SUGGESTION to the report: "Start dev server and re-run /opsx:verify for visual confirmation."
|
|
129
|
-
|
|
130
|
-
Include browser results in the verification report (step 9).`;
|
|
131
|
-
//# sourceMappingURL=mcp-guidance.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool-agnostic user interaction guidance for agent workflows.
|
|
3
|
-
*
|
|
4
|
-
* Cursor's AskUserQuestion is an optional enhancement, not a requirement.
|
|
5
|
-
* All editors (Windsurf, Claude Code, etc.) use plain chat with stop-and-wait.
|
|
6
|
-
*/
|
|
7
|
-
export declare const PROMPT_SELECT_CHANGE = "Prompt the user to select a change:\n - Run `openspec list --json` to get available changes\n - Present the options clearly in chat (numbered or labeled)\n - Ask ONE selection question; STOP and wait for the user's reply before continuing. NEVER answer, infer, or choose on the user's behalf.\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.";
|
|
8
|
-
export declare const PROMPT_SELECT_CHANGE_RECENT = "Run `openspec list --json` to get available changes sorted by most recently modified. Then prompt the user to select which change to work on in chat. Ask ONE selection question; STOP and wait for the user's reply before continuing. NEVER answer, infer, or choose on the user's behalf.\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.";
|
|
9
|
-
export declare const PROMPT_MULTI_SELECT_CHANGES = "Prompt the user to select one or more changes in chat:\n - Show each change with its schema\n - Allow multiple selections (e.g., \"select all that apply\" or comma-separated names)\n - STOP and wait for the user's reply before continuing. NEVER answer, infer, or choose on the user's behalf.\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.";
|
|
10
|
-
export declare const PROMPT_CONFIRM = "Ask the user to confirm before proceeding in chat:\n - State what they are confirming and the consequences\n - Present clear yes/no options\n - STOP and wait for the user's reply before continuing. NEVER answer, infer, or choose on the user's behalf.\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.";
|
|
11
|
-
export declare const PROMPT_OPEN_ENDED = "Ask the user an open-ended question in chat (no preset multiple-choice options):\n - STOP and wait for the user's reply before continuing. NEVER answer, infer, or choose on the user's behalf.\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.";
|
|
12
|
-
export declare const PROMPT_CLARIFY = "Ask the user a clarifying question in chat:\n - STOP and wait for the user's reply before continuing. NEVER answer, infer, or choose on the user's behalf.\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.";
|
|
13
|
-
export declare const COMPREHENSION_PRESENT_AND_GRADE = "**Present and grade**\n - Present each question in chat with labeled options (A/B/C/D or 1\u20134)\n - Ask ONE question at a time; after each, STOP and wait for the user's answer before the next question\n - NEVER select answers yourself, infer what the user would pick, or call `--record-comprehension-pass` until the user has answered every question\n - On Cursor, you may use the **AskUserQuestion tool** instead of plain chat for this step.\n - Grade: `score_percent = round(correct / question_count * 100)`\n - Pass when `score_percent >= comprehension.thresholdPercent` (default 80)";
|
|
14
|
-
export declare const TELEMETRY_WORKFLOW_INPUT_GUIDANCE = "**Telemetry**: When running `openspec new change`, ALWAYS pass:\n - `--workflow-input \"<user request verbatim>\"` \u2014 slash-command args or the user's open-ended answer\n - `--editor <cursor|windsurf|claude>` \u2014 the AI tool you are running in\n - For long or heavily quoted text, write a temp file and use `--workflow-input-file <path>` instead";
|
|
15
|
-
export declare const TELEMETRY_MODIFY_GUIDANCE = "**Telemetry**: When running `openspec instructions modify`, ALWAYS pass:\n - `--artifact <id>` \u2014 the source artifact being modified\n - `--workflow-input \"<user request verbatim>\"` \u2014 the user's modify request\n - `--editor <cursor|windsurf|claude>` \u2014 the AI tool you are running in\n - For long or heavily quoted text, use `--workflow-input-file <path>` instead";
|
|
16
|
-
//# sourceMappingURL=user-prompt-guidance.d.ts.map
|