scry-parse 1.0.0__tar.gz
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.
- scry_parse-1.0.0/.gitignore +4 -0
- scry_parse-1.0.0/CHANGELOG.md +21 -0
- scry_parse-1.0.0/LICENSE +21 -0
- scry_parse-1.0.0/PKG-INFO +86 -0
- scry_parse-1.0.0/README.md +53 -0
- scry_parse-1.0.0/agent/runtime/orchestrators/a0c8751b93f5.path +1 -0
- scry_parse-1.0.0/pyproject.toml +24 -0
- scry_parse-1.0.0/src/scry_parse/__init__.py +42 -0
- scry_parse-1.0.0/src/scry_parse/consts.py +19 -0
- scry_parse-1.0.0/src/scry_parse/markers.py +574 -0
- scry_parse-1.0.0/src/scry_parse/mint.py +34 -0
- scry_parse-1.0.0/src/scry_parse/validate.py +116 -0
- scry_parse-1.0.0/tests/__init__.py +0 -0
- scry_parse-1.0.0/tests/test_parse.py +872 -0
- scry_parse-1.0.0/uv.lock +139 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2026-05-14
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release: Python parser for scry-spec v1.0 marker format
|
|
13
|
+
- `parse_markers(content, language)` — parses EntryMarker, AnchorMarker, and BindingMarker from any host-language comment style
|
|
14
|
+
- `validate_marker(marker)` — validates parsed markers against spec rules, returns errors and warnings
|
|
15
|
+
- `mint_id(kind, name, content)` — generates spec-conformant marker IDs with deterministic (content-based) or random hashes
|
|
16
|
+
- `BASELINE_KINDS` and `BASELINE_STATUSES` constants per scry-spec v1.0
|
|
17
|
+
- Support for HTML/markdown, Python, TypeScript/JS, SQL, and Lisp comment styles
|
|
18
|
+
- FR3 positional exclusion: bind markers inside entry/anchor bodies are not indexed
|
|
19
|
+
- FR2 multi-anchor expansion: comma-separated loose anchors expand to N BindingMarker records
|
|
20
|
+
- Block form and single-line binding marker support
|
|
21
|
+
- 19 spec compliance tests plus additional edge case coverage
|
scry_parse-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 reflection
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: scry-parse
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Python parser for scry-spec v1.0 markers
|
|
5
|
+
Project-URL: Repository, https://github.com/prmichaelsen/scry-spec
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2026 reflection
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Requires-Dist: pyyaml>=6.0
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# scry-parse
|
|
35
|
+
|
|
36
|
+
Python parser for the [scry-spec v1.0](https://github.com/prmichaelsen/scry-spec) marker format.
|
|
37
|
+
|
|
38
|
+
## Install
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv pip install scry-parse
|
|
42
|
+
# or:
|
|
43
|
+
pip install scry-parse
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Usage
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from scry_parse import parse_markers, validate_marker, mint_id, BASELINE_KINDS, BASELINE_STATUSES
|
|
50
|
+
|
|
51
|
+
# Parse markers from file content
|
|
52
|
+
with open("my_file.md") as f:
|
|
53
|
+
content = f.read()
|
|
54
|
+
|
|
55
|
+
result = parse_markers(content)
|
|
56
|
+
|
|
57
|
+
for entry in result.entries:
|
|
58
|
+
print(entry.id, entry.kind, entry.summary)
|
|
59
|
+
|
|
60
|
+
for anchor in result.anchors:
|
|
61
|
+
print(anchor.name, anchor.description)
|
|
62
|
+
|
|
63
|
+
for binding in result.bindings:
|
|
64
|
+
print(binding.local_id, binding.ref)
|
|
65
|
+
|
|
66
|
+
# Validate a parsed marker
|
|
67
|
+
vr = validate_marker(result.entries[0])
|
|
68
|
+
if not vr.valid:
|
|
69
|
+
print(vr.errors)
|
|
70
|
+
|
|
71
|
+
# Generate a new marker ID
|
|
72
|
+
entry_id = mint_id("design", "auth-flow") # random hash
|
|
73
|
+
entry_id = mint_id("design", "auth-flow", content) # deterministic hash
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Supported comment styles
|
|
77
|
+
|
|
78
|
+
- HTML/Markdown: `<!-- @scry.entry ... @scry.entry.end -->`
|
|
79
|
+
- Python/Shell: `# @scry.entry ... # @scry.entry.end`
|
|
80
|
+
- TypeScript/JS: `// @scry.entry ... // @scry.entry.end`
|
|
81
|
+
- SQL: `-- @scry.entry ... -- @scry.entry.end`
|
|
82
|
+
- Lisp: `;; @scry.entry ... ;; @scry.entry.end`
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# scry-parse
|
|
2
|
+
|
|
3
|
+
Python parser for the [scry-spec v1.0](https://github.com/prmichaelsen/scry-spec) marker format.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv pip install scry-parse
|
|
9
|
+
# or:
|
|
10
|
+
pip install scry-parse
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from scry_parse import parse_markers, validate_marker, mint_id, BASELINE_KINDS, BASELINE_STATUSES
|
|
17
|
+
|
|
18
|
+
# Parse markers from file content
|
|
19
|
+
with open("my_file.md") as f:
|
|
20
|
+
content = f.read()
|
|
21
|
+
|
|
22
|
+
result = parse_markers(content)
|
|
23
|
+
|
|
24
|
+
for entry in result.entries:
|
|
25
|
+
print(entry.id, entry.kind, entry.summary)
|
|
26
|
+
|
|
27
|
+
for anchor in result.anchors:
|
|
28
|
+
print(anchor.name, anchor.description)
|
|
29
|
+
|
|
30
|
+
for binding in result.bindings:
|
|
31
|
+
print(binding.local_id, binding.ref)
|
|
32
|
+
|
|
33
|
+
# Validate a parsed marker
|
|
34
|
+
vr = validate_marker(result.entries[0])
|
|
35
|
+
if not vr.valid:
|
|
36
|
+
print(vr.errors)
|
|
37
|
+
|
|
38
|
+
# Generate a new marker ID
|
|
39
|
+
entry_id = mint_id("design", "auth-flow") # random hash
|
|
40
|
+
entry_id = mint_id("design", "auth-flow", content) # deterministic hash
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Supported comment styles
|
|
44
|
+
|
|
45
|
+
- HTML/Markdown: `<!-- @scry.entry ... @scry.entry.end -->`
|
|
46
|
+
- Python/Shell: `# @scry.entry ... # @scry.entry.end`
|
|
47
|
+
- TypeScript/JS: `// @scry.entry ... // @scry.entry.end`
|
|
48
|
+
- SQL: `-- @scry.entry ... -- @scry.entry.end`
|
|
49
|
+
- Lisp: `;; @scry.entry ... ;; @scry.entry.end`
|
|
50
|
+
|
|
51
|
+
## License
|
|
52
|
+
|
|
53
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/home/prmichaelsen/.acp/projects/reflection
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "scry-parse"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Python parser for scry-spec v1.0 markers"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
dependencies = ["pyyaml>=6.0"]
|
|
13
|
+
|
|
14
|
+
[project.optional-dependencies]
|
|
15
|
+
dev = ["pytest>=7.0"]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Repository = "https://github.com/prmichaelsen/scry-spec"
|
|
19
|
+
|
|
20
|
+
[tool.hatch.build.targets.wheel]
|
|
21
|
+
packages = ["src/scry_parse"]
|
|
22
|
+
|
|
23
|
+
[tool.pytest.ini_options]
|
|
24
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""scry-parse: Python parser for scry-spec v1.0 markers.
|
|
2
|
+
|
|
3
|
+
Public API:
|
|
4
|
+
parse_markers(content, language=None, file="") -> ParseResult
|
|
5
|
+
validate_marker(marker) -> ValidationResult
|
|
6
|
+
mint_id(kind, name, content=None) -> str
|
|
7
|
+
BASELINE_KINDS
|
|
8
|
+
BASELINE_STATUSES
|
|
9
|
+
|
|
10
|
+
Dataclasses:
|
|
11
|
+
EntryMarker
|
|
12
|
+
AnchorMarker
|
|
13
|
+
BindingMarker
|
|
14
|
+
ParseResult
|
|
15
|
+
ValidationResult
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from scry_parse.markers import (
|
|
19
|
+
parse_markers,
|
|
20
|
+
EntryMarker,
|
|
21
|
+
AnchorMarker,
|
|
22
|
+
BindingMarker,
|
|
23
|
+
ParseResult,
|
|
24
|
+
)
|
|
25
|
+
from scry_parse.validate import validate_marker, ValidationResult
|
|
26
|
+
from scry_parse.mint import mint_id
|
|
27
|
+
from scry_parse.consts import BASELINE_KINDS, BASELINE_STATUSES
|
|
28
|
+
|
|
29
|
+
__all__ = [
|
|
30
|
+
"parse_markers",
|
|
31
|
+
"EntryMarker",
|
|
32
|
+
"AnchorMarker",
|
|
33
|
+
"BindingMarker",
|
|
34
|
+
"ParseResult",
|
|
35
|
+
"validate_marker",
|
|
36
|
+
"ValidationResult",
|
|
37
|
+
"mint_id",
|
|
38
|
+
"BASELINE_KINDS",
|
|
39
|
+
"BASELINE_STATUSES",
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Constants for scry-spec v1.0: baseline kinds, statuses, and ID regexes."""
|
|
2
|
+
import re
|
|
3
|
+
|
|
4
|
+
BASELINE_KINDS = (
|
|
5
|
+
"design", "pattern", "spec", "lesson", "internal",
|
|
6
|
+
"task", "milestone",
|
|
7
|
+
"report", "audit", "research",
|
|
8
|
+
"code",
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
BASELINE_STATUSES = ("draft", "active", "deprecated")
|
|
12
|
+
|
|
13
|
+
# ID validation regexes per scry-spec v1.0
|
|
14
|
+
# Entry/doc IDs: kind.name~8hexchars
|
|
15
|
+
ID_REGEX = re.compile(r'^[a-z]+\.[a-z0-9-]+~[a-f0-9]{8}$')
|
|
16
|
+
# Anchor/impl/test IDs: name~8hexchars (no dot)
|
|
17
|
+
ANCHOR_ID_REGEX = re.compile(r'^[a-z0-9-]+~[a-f0-9]{8}$')
|
|
18
|
+
# Loose anchor IDs used in refs: uppercase letters followed by digits (e.g. FR3, UT1)
|
|
19
|
+
LOOSE_ANCHOR_REGEX = re.compile(r'^[A-Z]+[0-9]+$')
|