-
Notifications
You must be signed in to change notification settings - Fork 0
Add bootstrap command contract #326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
flyingrobots
wants to merge
1
commit into
main
Choose a base branch
from
feat/bootstrap-command-contract
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,151 @@ | ||
| { | ||
| "$schema": "https://json-schema.org/draft/2020-12/schema", | ||
| "$id": "https://github.com/neuroglyph/git-mind/docs/contracts/cli/bootstrap.schema.json", | ||
| "title": "git-mind bootstrap --json", | ||
| "description": "Bootstrap summary output from `git mind bootstrap --json`", | ||
| "type": "object", | ||
| "required": [ | ||
| "schemaVersion", | ||
| "command", | ||
| "dryRun", | ||
| "artifacts", | ||
| "entities", | ||
| "relationships", | ||
| "confidence", | ||
| "provenance", | ||
| "warnings", | ||
| "next" | ||
| ], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "schemaVersion": { | ||
| "type": "integer", | ||
| "const": 1 | ||
| }, | ||
| "command": { | ||
| "type": "string", | ||
| "const": "bootstrap" | ||
| }, | ||
| "dryRun": { | ||
| "type": "boolean" | ||
| }, | ||
| "artifacts": { | ||
| "type": "object", | ||
| "required": ["scanned", "byKind", "skipped", "warnings"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "scanned": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "byKind": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| } | ||
| }, | ||
| "skipped": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "warnings": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "entities": { | ||
| "type": "object", | ||
| "required": ["created", "unchanged", "byPrefix"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "created": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "unchanged": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "byPrefix": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "relationships": { | ||
| "type": "object", | ||
| "required": ["created", "unchanged", "byType"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "created": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "unchanged": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "byType": { | ||
| "type": "object", | ||
| "additionalProperties": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| } | ||
| } | ||
| } | ||
| }, | ||
| "confidence": { | ||
| "type": "object", | ||
| "required": ["high", "medium", "low"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "high": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "medium": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "low": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| } | ||
| } | ||
| }, | ||
| "provenance": { | ||
| "type": "object", | ||
| "required": ["inferred", "missing"], | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "inferred": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| }, | ||
| "missing": { | ||
| "type": "integer", | ||
| "minimum": 0 | ||
| } | ||
| } | ||
| }, | ||
| "warnings": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| }, | ||
| "next": { | ||
| "type": "array", | ||
| "items": { | ||
| "type": "string" | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /** | ||
| * @module bootstrap | ||
| * Hill 1 semantic bootstrap contract helpers. | ||
| */ | ||
|
|
||
| export const BOOTSTRAP_NEXT_COMMANDS = [ | ||
| 'git mind status', | ||
| 'git mind nodes', | ||
| 'git mind review', | ||
| ]; | ||
|
|
||
| /** | ||
| * @typedef {object} BootstrapSummary | ||
| * @property {boolean} dryRun | ||
| * @property {{ scanned: number, byKind: Record<string, number>, skipped: number, warnings: string[] }} artifacts | ||
| * @property {{ created: number, unchanged: number, byPrefix: Record<string, number> }} entities | ||
| * @property {{ created: number, unchanged: number, byType: Record<string, number> }} relationships | ||
| * @property {{ high: number, medium: number, low: number }} confidence | ||
| * @property {{ inferred: number, missing: number }} provenance | ||
| * @property {string[]} warnings | ||
| * @property {string[]} next | ||
| */ | ||
|
|
||
| /** | ||
| * Create the current bootstrap summary payload. | ||
| * | ||
| * This first slice intentionally exposes the command contract before the | ||
| * scanner/inference pipeline exists. Keeping the payload construction pure | ||
| * makes the dry-run no-write guarantee easy to test and preserves a stable | ||
| * shape for later slices to fill with real counts. | ||
| * | ||
| * @param {{ dryRun?: boolean }} [opts] | ||
| * @returns {BootstrapSummary} | ||
| */ | ||
| export function createBootstrapSummary(opts = {}) { | ||
| const dryRun = opts.dryRun === true; | ||
|
|
||
| return { | ||
| dryRun, | ||
| artifacts: { | ||
| scanned: 0, | ||
| byKind: {}, | ||
| skipped: 0, | ||
| warnings: [], | ||
| }, | ||
| entities: { | ||
| created: 0, | ||
| unchanged: 0, | ||
| byPrefix: {}, | ||
| }, | ||
| relationships: { | ||
| created: 0, | ||
| unchanged: 0, | ||
| byType: {}, | ||
| }, | ||
| confidence: { | ||
| high: 0, | ||
| medium: 0, | ||
| low: 0, | ||
| }, | ||
| provenance: { | ||
| inferred: 0, | ||
| missing: 0, | ||
| }, | ||
| warnings: [], | ||
| next: [...BOOTSTRAP_NEXT_COMMANDS], | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the new bootstrap dispatch,
parseFlagsaccepts any unrecognized--...and this handler only readsdry-run/json, so a typo likegit mind bootstrap --dryrun --jsonsilently consumes--jsonas the unknown flag's value and runs in non-dry-run, non-JSON mode instead of failing. Because--dry-runis the command's no-write safety switch, validate the allowed bootstrap flags/positionals before callingbootstrap.Useful? React with 👍 / 👎.