@ccdd/core 3.3.0 → 4.0.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 +69 -62
- package/dist/src/artifact-scope.d.ts +6 -0
- package/dist/src/artifact-scope.js +27 -0
- package/dist/src/artifact-scope.js.map +1 -0
- package/dist/src/definitions.d.ts +33 -23
- package/dist/src/sdk.d.ts +3 -8
- package/dist/src/sdk.js +2 -3
- package/dist/src/sdk.js.map +1 -1
- package/dist/src/tools/contracts.d.ts +34 -78
- package/examples/artifact-folders/README.md +18 -0
- package/examples/artifact-folders/coding-style/ccdd.json +128 -0
- package/examples/artifact-folders/coding-style/style.md +3 -0
- package/examples/artifact-folders/explosion/blind-pair.mjs +19 -0
- package/examples/artifact-folders/explosion/ccdd.json +220 -0
- package/examples/artifact-folders/explosion/effect/ccdd.json +128 -0
- package/examples/artifact-folders/explosion/preview/ccdd.json +142 -0
- package/examples/artifact-folders/theme-image/ccdd.json +128 -0
- package/examples/artifact-folders/theme-image/theme.png +0 -0
- package/examples/computed-views/README.md +12 -0
- package/examples/computed-views/checkout/ccdd.json +133 -0
- package/examples/computed-views/search/ccdd.json +133 -0
- package/examples/computed-views/view.mjs +13 -0
- package/examples/custom-text-reader/README.md +7 -19
- package/examples/custom-text-reader/spec/ccdd.json +60 -0
- package/examples/custom-text-reader/view.mjs +20 -0
- package/examples/custom-text-reader/why/ccdd.json +46 -0
- package/package.json +21 -7
- package/examples/artifact-groups/README.md +0 -60
- package/examples/artifact-groups/ccdd.config.ts +0 -37
- package/examples/custom-text-reader/ccdd.config.ts +0 -64
- package/examples/generated-artifacts/README.md +0 -55
- package/examples/generated-artifacts/ccdd.config.ts +0 -86
- /package/examples/{artifact-groups → artifact-folders/explosion/effect}/effect.md +0 -0
- /package/examples/{artifact-groups → artifact-folders/explosion/preview}/preview.png +0 -0
- /package/examples/{generated-artifacts/scenarios/checkout.json → computed-views/checkout/scenario.json} +0 -0
- /package/examples/{generated-artifacts/scenarios/search.json → computed-views/search/scenario.json} +0 -0
- /package/examples/custom-text-reader/{spec.md → spec/spec.md} +0 -0
- /package/examples/custom-text-reader/{why.md → why/why.md} +0 -0
package/README.md
CHANGED
|
@@ -1,94 +1,101 @@
|
|
|
1
1
|
# CCDD
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://cdd.boardsketch.com)
|
|
3
|
+
**Let verification define the project.** Give each Artifact its own criteria and the tools a reviewer needs to inspect it. An Artifact can be code, tests, a specification, an image or any other folder of project material.
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Put a `ccdd.json` in that folder. It owns the Artifact's name, view tools and Critics. CCDD finds those declarations, connects references and collects actual review evidence.
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-

|
|
17
|
-
|
|
18
|
-
Three terms explain the picture:
|
|
19
|
-
|
|
20
|
-
| Term | Meaning | Example |
|
|
21
|
-
| --- | --- | --- |
|
|
22
|
-
| **Artifact** | A named file, folder, captured data value, or group of materials to review. | `spec.md`, `tests/`, an image, or a generated scenario. |
|
|
23
|
-
| **Critic** | A check with one target, reference materials, and a reviewer. | “Does this design meet these requirements?” |
|
|
24
|
-
| **Artifact tool** | A way for a reviewer to inspect an Artifact. | Read text, view an image, or open a desktop application. |
|
|
25
|
-
|
|
26
|
-
Each Critic declares its target and references. These relationships form a directed acyclic graph, or **DAG**: checks can branch and join, but cannot depend on themselves through a cycle. Design and Tests connect to Implementation through separate Critic lines. Requirements are an explicitly accepted starting point in this example.
|
|
27
|
-
|
|
28
|
-
## What you do
|
|
29
|
-
|
|
30
|
-
1. **Name your materials.** Give each Artifact an ID, a type, and a file/folder path or a source for generated data. Groups collect existing Artifacts.
|
|
31
|
-
2. **Connect tools.** Use the optional default tools or write your own `metadata` and `execute` function. Register them by Artifact type in `ccdd.config.ts`.
|
|
32
|
-
3. **Define checks.** For each Critic, choose the target, its references, the review criteria, and an Agent, Human, or Runtime reviewer.
|
|
33
|
-
4. **Request a review.** Read the findings, update your project, and request another check when needed.
|
|
34
|
-
|
|
35
|
-
For example, a document tool registered as `read` becomes `read_spec` when connected to the `spec` Artifact. CCDD gives the Agent its name, description, and input schema. When the Agent calls it, CCDD invokes your local `execute` function against the fixed review input and returns the content to the Agent.
|
|
7
|
+
```text
|
|
8
|
+
project/
|
|
9
|
+
why/ccdd.json
|
|
10
|
+
spec/ccdd.json
|
|
11
|
+
tests/ccdd.json
|
|
12
|
+
implementation/ccdd.json
|
|
13
|
+
```
|
|
36
14
|
|
|
37
|
-
|
|
15
|
+
A Critic can ask an Agent to compare Spec with Why, ask a person to compare two images, or run tests against an implementation. It belongs to the Artifact it evaluates. References such as `{spec}` connect it to the other Artifacts it uses.
|
|
16
|
+
|
|
17
|
+
```mermaid
|
|
18
|
+
flowchart LR
|
|
19
|
+
subgraph Project[Your project]
|
|
20
|
+
Why[Why] -. instruction .-> Spec[Spec]
|
|
21
|
+
Spec -. instruction .-> Tests[Tests]
|
|
22
|
+
Tests -. mount / instruction .-> Implementation[Implementation]
|
|
23
|
+
end
|
|
24
|
+
Project -. folder declarations .-> CCDD
|
|
25
|
+
CCDD --> Agent[Agent review]
|
|
26
|
+
CCDD --> Human[Human review]
|
|
27
|
+
CCDD --> Runtime[Runtime tests]
|
|
28
|
+
Agent --> Evidence[Actual evidence]
|
|
29
|
+
Human --> Evidence
|
|
30
|
+
Runtime --> Evidence
|
|
31
|
+
Evidence --> CCDD
|
|
32
|
+
style Project fill:#eef6ff,stroke:#5c83aa
|
|
33
|
+
style CCDD fill:#eef9ef,stroke:#588060
|
|
34
|
+
```
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
These relationships define required input and verification, not execution order. Mutual dependencies are allowed: both Critics may run together, and final validation requires both matching results. Child Artifact folders are automatic dependencies. Logical `mounts` connect other folders without copies or symlinks.
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
## Start with a runtime check
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
Use Node.js 22 LTS, version 22.19.0 or later.
|
|
44
41
|
|
|
45
42
|
```sh
|
|
46
|
-
npm install --ignore-scripts @ccdd/core @ccdd/project
|
|
43
|
+
npm install --ignore-scripts @ccdd/core@^4 @ccdd/project@^4
|
|
47
44
|
```
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
Inside an Artifact folder, create `ccdd.json`:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"name": "implementation",
|
|
51
|
+
"critics": [{
|
|
52
|
+
"id": "tests",
|
|
53
|
+
"title": "Pass the implementation tests",
|
|
54
|
+
"profile": { "kind": "runtime", "command": "node", "args": ["--test", "check.test.mjs"] },
|
|
55
|
+
"payload": { "instruction": "Run the tests for {implementation}." }
|
|
56
|
+
}]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
50
59
|
|
|
51
|
-
|
|
60
|
+
Add your actual `check.test.mjs`, then run from the workspace root:
|
|
52
61
|
|
|
53
62
|
```sh
|
|
54
|
-
npx ccdd-project
|
|
63
|
+
npx ccdd-project config check
|
|
55
64
|
npx ccdd-project plan implementation --recursive
|
|
56
65
|
npx ccdd-project verify implementation --recursive --wait
|
|
57
|
-
npx ccdd-project
|
|
66
|
+
npx ccdd-project status implementation
|
|
58
67
|
```
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
## What you get back
|
|
69
|
+
The [getting-started guide](docs/getting-started.md) includes a complete runnable example. Version 4 is a breaking change; existing projects should follow the [migration guide](docs/migration-v4.md).
|
|
63
70
|
|
|
64
|
-
|
|
71
|
+
## Read the result
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
Every actual review returns a verdict, summary and concrete evidence. GREEN means its criteria were met; RED means they were not. Execution problems produce ERROR. Final validation needs matching PASS evidence for all required Critics and dependencies. A folder without Critics stays UNREVIEWED unless explicitly declared `basis: true`.
|
|
67
74
|
|
|
68
|
-
|
|
75
|
+
An individual check runs its selected Critics immediately. If other required evidence is missing, their results are saved and the request is INCOMPLETE. Add `--recursive` to include those other evaluations. CCDD reuses matching actual evidence and computes freshness when queried; it does not store stale flags.
|
|
69
76
|
|
|
70
|
-
|
|
77
|
+
Reviews run in the workspace you supply. Keep it unchanged until completion, including Human waiting. Records, caches and generated output live outside it. To keep editing elsewhere, create your own worktree and pass it with `--repo`.
|
|
71
78
|
|
|
72
|
-
|
|
73
|
-
- [Use default text, file, image, and desktop tools](packages/default-tools/README.md).
|
|
74
|
-
- [Review a group of materials](examples/artifact-groups/README.md), such as an effect description and its preview image.
|
|
75
|
-
- [Review generated scenario data](docs/generated-artifacts.md) through tools that read a fixed captured value.
|
|
76
|
-
- [Use Agent and Human reviewers](docs/reviewers.md), including credentials and result submission.
|
|
77
|
-
- [Explore the demo](docs/demo.md): Why → Spec → Tests → Implementation.
|
|
78
|
-
- [Look up commands, reuse rules, and exit codes](docs/project-validation.md).
|
|
79
|
+
## Next steps
|
|
79
80
|
|
|
80
|
-
|
|
81
|
+
- [Define a custom view script](examples/custom-text-reader/README.md) with JSON stdin/stdout, using any language.
|
|
82
|
+
- [Register optional text, image and desktop tools](packages/default-tools/README.md).
|
|
83
|
+
- [Compose folders and mounts](examples/artifact-folders/README.md), including coding-style and blind image comparison Critics.
|
|
84
|
+
- [Compute views on demand](examples/computed-views/README.md) from scenario material.
|
|
85
|
+
- [Configure Agent and Human reviewers](docs/reviewers.md).
|
|
86
|
+
- [Try Why → Spec → Tests → Implementation](docs/demo.md).
|
|
87
|
+
- [Look up commands and evidence rules](docs/project-validation.md).
|
|
81
88
|
|
|
82
|
-
|
|
89
|
+
The optional local monitor shows folders, relationships, cycles, review progress and saved results. Start it with `npx ccdd-project monitor`.
|
|
83
90
|
|
|
84
|
-
| Package |
|
|
91
|
+
| Package | Responsibility |
|
|
85
92
|
| --- | --- |
|
|
86
|
-
| `@ccdd/core` |
|
|
87
|
-
| `@ccdd/project` |
|
|
88
|
-
| `@ccdd/default-tools` | Optional
|
|
93
|
+
| `@ccdd/core` | Public definitions and logical path resolution. |
|
|
94
|
+
| `@ccdd/project` | Validation, CLI, Broker, Executors and monitor. |
|
|
95
|
+
| `@ccdd/default-tools` | Optional common view scripts; no automatic registration. |
|
|
89
96
|
|
|
90
|
-
|
|
97
|
+
See [Contributing](CONTRIBUTING.md), [the context map](CONTEXT-MAP.md), [detailed contracts](docs/contracts.md) and [release instructions](docs/releases.md). Repository content and review prompts use English.
|
|
91
98
|
|
|
92
99
|
## License
|
|
93
100
|
|
|
94
|
-
|
|
101
|
+
[MIT](LICENSE).
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ArtifactScope } from './definitions.js';
|
|
2
|
+
/** Resolve logical paths without a filesystem. Every hop consumes path components. */
|
|
3
|
+
export declare function resolveScopePath(scope: ArtifactScope, artifactId: string, path?: string): {
|
|
4
|
+
artifactId: string;
|
|
5
|
+
path: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Resolve logical paths without a filesystem. Every hop consumes path components. */
|
|
2
|
+
export function resolveScopePath(scope, artifactId, path = '') {
|
|
3
|
+
if (typeof path !== 'string' || path.length > 4096 || /[\\\x00-\x1f\x7f:]/.test(path) || path.startsWith('/') || path.split('/').some(part => part === '.' || part === '..' || !part && path !== ''))
|
|
4
|
+
throw new Error('Artifact path must be a safe relative logical path.');
|
|
5
|
+
let current = artifactId, remaining = path;
|
|
6
|
+
for (;;) {
|
|
7
|
+
if (!Object.hasOwn(scope, current))
|
|
8
|
+
throw new Error(`Artifact is outside this review: ${current}`);
|
|
9
|
+
const entry = scope[current];
|
|
10
|
+
if (!remaining)
|
|
11
|
+
return { artifactId: current, path: '' };
|
|
12
|
+
const first = remaining.split('/')[0];
|
|
13
|
+
if (Object.hasOwn(entry.mounts, first)) {
|
|
14
|
+
current = entry.mounts[first];
|
|
15
|
+
remaining = remaining.slice(first.length).replace(/^\//, '');
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
const child = Object.keys(entry.children).find(name => remaining === name || remaining.startsWith(`${name}/`));
|
|
19
|
+
if (child !== undefined) {
|
|
20
|
+
current = entry.children[child];
|
|
21
|
+
remaining = remaining.slice(child.length).replace(/^\//, '');
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
return { artifactId: current, path: remaining };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=artifact-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact-scope.js","sourceRoot":"","sources":["../../src/artifact-scope.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,UAAU,gBAAgB,CAAC,KAAoB,EAAE,UAAkB,EAAE,IAAI,GAAG,EAAE;IAClF,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,GAAG,IAAI,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IAC7Q,IAAI,OAAO,GAAG,UAAU,EAAE,SAAS,GAAG,IAAI,CAAC;IAC3C,SAAS,CAAC;QACR,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,OAAO,EAAE,CAAC,CAAC;QACnG,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,IAAI,CAAC,SAAS;YAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QACzD,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC;YACvC,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAAC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAAC,SAAS;QACxG,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,KAAK,IAAI,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;QAC/G,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YAAC,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAAC,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAAC,SAAS;QAAC,CAAC;QACrI,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAClD,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ArtifactViews, EnvironmentRequirement } from './tools/contracts.js';
|
|
2
|
+
/** Public declarations contain data only; discovery never executes code. */
|
|
2
3
|
export interface AgentProfile {
|
|
3
4
|
kind: 'agent';
|
|
4
5
|
provider: string;
|
|
@@ -23,8 +24,6 @@ export interface ReviewPayload {
|
|
|
23
24
|
export interface CriticDefinition {
|
|
24
25
|
id: string;
|
|
25
26
|
title: string;
|
|
26
|
-
target: string;
|
|
27
|
-
deps: string[];
|
|
28
27
|
profile: CriticProfile;
|
|
29
28
|
payload: ReviewPayload;
|
|
30
29
|
}
|
|
@@ -34,32 +33,43 @@ export type StaleStrategy = {
|
|
|
34
33
|
} | {
|
|
35
34
|
kind: 'always';
|
|
36
35
|
};
|
|
37
|
-
export interface
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export interface ArtifactManifest {
|
|
37
|
+
name: string;
|
|
38
|
+
critics?: CriticDefinition[];
|
|
39
|
+
views?: ArtifactViews;
|
|
40
|
+
mounts?: Record<string, string>;
|
|
40
41
|
basis?: boolean;
|
|
41
42
|
stale?: StaleStrategy;
|
|
43
|
+
envRequirements?: Record<string, EnvironmentRequirement>;
|
|
42
44
|
}
|
|
43
|
-
export interface
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
export interface ArtifactDefinition {
|
|
46
|
+
name: string;
|
|
47
|
+
path: string;
|
|
48
|
+
views: ArtifactViews;
|
|
49
|
+
mounts: Record<string, string>;
|
|
50
|
+
/** Nearest marked descendants, indexed by their physical relative paths. */
|
|
51
|
+
children: Record<string, string>;
|
|
46
52
|
basis?: boolean;
|
|
47
53
|
stale?: StaleStrategy;
|
|
54
|
+
envRequirements?: Record<string, EnvironmentRequirement>;
|
|
48
55
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
56
|
+
export interface ResolvedCriticDefinition extends CriticDefinition {
|
|
57
|
+
localId: string;
|
|
58
|
+
target: string;
|
|
59
|
+
deps: string[];
|
|
60
|
+
/** Original instruction names map to canonical Artifact identities. */
|
|
61
|
+
references: Record<string, string>;
|
|
62
|
+
}
|
|
63
|
+
export interface ArtifactRelation {
|
|
53
64
|
source: string;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
59
|
-
path?: never;
|
|
65
|
+
target: string;
|
|
66
|
+
kind: 'child' | 'mount' | 'instruction';
|
|
67
|
+
name?: string;
|
|
68
|
+
criticId?: string;
|
|
60
69
|
}
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
export interface ArtifactScopeEntry {
|
|
71
|
+
path: string;
|
|
72
|
+
children: Record<string, string>;
|
|
73
|
+
mounts: Record<string, string>;
|
|
65
74
|
}
|
|
75
|
+
export type ArtifactScope = Record<string, ArtifactScopeEntry>;
|
package/dist/src/sdk.d.ts
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { InferSchema, JsonSchema, ToolDefinition, ToolMetadata } from './tools/contracts.js';
|
|
2
2
|
export type * from './tools/contracts.js';
|
|
3
3
|
export type * from './definitions.js';
|
|
4
|
-
export
|
|
4
|
+
export { resolveScopePath } from './artifact-scope.js';
|
|
5
|
+
/** An optional script-authoring helper, not a configuration registration API. */
|
|
5
6
|
export declare function defineTool<const S extends JsonSchema>(tool: Omit<ToolDefinition<InferSchema<S>>, 'metadata'> & {
|
|
6
7
|
metadata: Omit<ToolMetadata, 'inputSchema'> & {
|
|
7
8
|
inputSchema: S;
|
|
8
9
|
};
|
|
9
10
|
}): ToolDefinition<InferSchema<S>>;
|
|
10
|
-
export declare function defineDataTool<const S extends JsonSchema>(tool: Omit<ToolDefinition<InferSchema<S>, DataToolContext>, 'metadata'> & {
|
|
11
|
-
metadata: Omit<ToolMetadata, 'inputSchema' | 'artifactKind'> & {
|
|
12
|
-
inputSchema: S;
|
|
13
|
-
};
|
|
14
|
-
}): ToolDefinition<InferSchema<S>, DataToolContext>;
|
|
15
|
-
export declare function defineArtifactSource(source: ArtifactSourceDefinition): ArtifactSourceDefinition;
|
package/dist/src/sdk.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { resolveScopePath } from './artifact-scope.js';
|
|
2
|
+
/** An optional script-authoring helper, not a configuration registration API. */
|
|
2
3
|
export function defineTool(tool) { return tool; }
|
|
3
|
-
export function defineDataTool(tool) { return { ...tool, metadata: { ...tool.metadata, artifactKind: 'data' } }; }
|
|
4
|
-
export function defineArtifactSource(source) { return source; }
|
|
5
4
|
//# sourceMappingURL=sdk.js.map
|
package/dist/src/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAGA,
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,iFAAiF;AACjF,MAAM,UAAU,UAAU,CAA6B,IAA6H,IAAoC,OAAO,IAAI,CAAC,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ArtifactDefinition, ArtifactManifest, ArtifactScope } from '../definitions.js';
|
|
2
2
|
export type JsonValue = null | boolean | number | string | JsonValue[] | {
|
|
3
3
|
[key: string]: JsonValue;
|
|
4
4
|
};
|
|
@@ -9,21 +9,22 @@ export interface ToolMetadata {
|
|
|
9
9
|
inputSchema: JsonSchema;
|
|
10
10
|
resultKinds: ToolResultKind[];
|
|
11
11
|
observation: 'content' | 'none';
|
|
12
|
-
artifactKind?: 'file' | 'directory' | 'any'
|
|
12
|
+
artifactKind?: 'file' | 'directory' | 'any';
|
|
13
13
|
timeoutMs?: number;
|
|
14
|
-
/**
|
|
14
|
+
/** Workspace-relative runtime material whose content affects this tool. */
|
|
15
15
|
executionPaths?: string[];
|
|
16
16
|
}
|
|
17
|
-
export interface
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
export interface ScriptDefinition {
|
|
18
|
+
command: string;
|
|
19
|
+
args: string[];
|
|
20
|
+
}
|
|
21
|
+
export interface ScriptToolDefinition {
|
|
22
|
+
metadata: ToolMetadata;
|
|
23
|
+
script: ScriptDefinition;
|
|
24
|
+
}
|
|
25
|
+
export interface ArtifactViews {
|
|
26
|
+
agentTools?: Record<string, ScriptToolDefinition>;
|
|
27
|
+
humanTools?: Record<string, ScriptToolDefinition>;
|
|
27
28
|
}
|
|
28
29
|
export type ToolContent = {
|
|
29
30
|
type: 'text';
|
|
@@ -50,52 +51,25 @@ export interface ToolResult {
|
|
|
50
51
|
detail?: string;
|
|
51
52
|
};
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
-
export interface DataToolContext {
|
|
54
|
+
export interface ScriptToolContext {
|
|
55
55
|
artifactId: string;
|
|
56
|
+
artifactPath: string;
|
|
56
57
|
outputDir: string;
|
|
57
58
|
tmpDir: string;
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
resolveExecutionPath(path: string): Promise<string>;
|
|
59
|
+
/** Canonical paths and logical connections for this review's allowed scope. */
|
|
60
|
+
scope: ArtifactScope;
|
|
61
61
|
}
|
|
62
|
-
export interface
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
export interface ArtifactSourceMetadata {
|
|
68
|
-
identity: ArtifactIdentityStrategy;
|
|
69
|
-
/** Queries may invoke only sources explicitly declaring read-only preparation. */
|
|
70
|
-
preparation: 'read-only' | 'explicit';
|
|
71
|
-
timeoutMs?: number;
|
|
62
|
+
export interface ScriptToolRequest {
|
|
63
|
+
version: 1;
|
|
64
|
+
context: ScriptToolContext;
|
|
65
|
+
args: Record<string, unknown>;
|
|
72
66
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
67
|
+
/** Convenience interface for script authors. Project never imports these functions. */
|
|
68
|
+
export interface ToolContext extends ScriptToolContext {
|
|
69
|
+
artifactDirectory: boolean;
|
|
76
70
|
signal: AbortSignal;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
80
|
-
export interface ArtifactSourceResult {
|
|
81
|
-
data: JsonValue;
|
|
82
|
-
revision?: string;
|
|
83
|
-
}
|
|
84
|
-
export interface ArtifactSourceDefinition {
|
|
85
|
-
metadata: ArtifactSourceMetadata;
|
|
86
|
-
prepare(context: ArtifactSourceContext): ArtifactSourceResult | Promise<ArtifactSourceResult>;
|
|
87
|
-
/** A custom identity asserts equivalence of the complete supplied data. */
|
|
88
|
-
fingerprint?(data: JsonValue): string | Promise<string>;
|
|
89
|
-
}
|
|
90
|
-
export interface PreparedArtifactData {
|
|
91
|
-
version: 1;
|
|
92
|
-
identity: ArtifactIdentityStrategy & {
|
|
93
|
-
fingerprint: string;
|
|
94
|
-
};
|
|
95
|
-
/** Integrity hash of the canonical data, independent of semantic equivalence. */
|
|
96
|
-
contentHash: string;
|
|
97
|
-
data: JsonValue;
|
|
98
|
-
revision?: string;
|
|
71
|
+
resolvePath(path?: string): Promise<string>;
|
|
72
|
+
resolveExecutionPath?(path: string): Promise<string>;
|
|
99
73
|
}
|
|
100
74
|
export interface ToolDefinition<Args = Record<string, unknown>, Context = ToolContext> {
|
|
101
75
|
metadata: ToolMetadata;
|
|
@@ -108,48 +82,31 @@ export interface ToolDefinition<Args = Record<string, unknown>, Context = ToolCo
|
|
|
108
82
|
message: string;
|
|
109
83
|
}>;
|
|
110
84
|
}
|
|
111
|
-
export interface ArtifactToolsConfig {
|
|
112
|
-
agentTools?: Record<string, ToolDefinition<any, any>>;
|
|
113
|
-
humanTools?: Record<string, ToolDefinition<any, any>>;
|
|
114
|
-
}
|
|
115
85
|
export interface EnvironmentRequirement {
|
|
116
86
|
description: string;
|
|
117
|
-
/** Project-relative Node script; a zero exit status confirms readiness. */
|
|
118
87
|
script: string;
|
|
119
88
|
timeoutMs?: number;
|
|
120
|
-
/** Additional project files or directories used by the check. */
|
|
121
89
|
inputs?: string[];
|
|
122
90
|
}
|
|
123
|
-
export interface Config {
|
|
124
|
-
artifacts: Record<string, ArtifactEntryDefinition>;
|
|
125
|
-
artifactTypes: Record<string, ArtifactToolsConfig>;
|
|
126
|
-
critics: CriticDefinition[];
|
|
127
|
-
envRequirements?: Record<string, EnvironmentRequirement>;
|
|
128
|
-
artifactSources?: Record<string, ArtifactSourceDefinition>;
|
|
129
|
-
}
|
|
130
|
-
export type ConfigFactory = () => Config | Promise<Config>;
|
|
131
91
|
export interface ConfigManifest {
|
|
132
|
-
version:
|
|
92
|
+
version: 2;
|
|
133
93
|
configHash: string;
|
|
134
|
-
|
|
94
|
+
artifacts: Record<string, ArtifactDefinition>;
|
|
95
|
+
declarations: {
|
|
135
96
|
path: string;
|
|
136
97
|
hash: string;
|
|
137
98
|
}[];
|
|
138
|
-
|
|
139
|
-
agentTools: Record<string, ToolMetadata>;
|
|
140
|
-
humanTools: Record<string, ToolMetadata>;
|
|
141
|
-
}>;
|
|
142
|
-
envRequirements?: Record<string, EnvironmentRequirement>;
|
|
143
|
-
environmentInputs?: {
|
|
99
|
+
executionInputs?: {
|
|
144
100
|
path: string;
|
|
145
101
|
hash: string;
|
|
146
102
|
}[];
|
|
147
|
-
|
|
103
|
+
envRequirements?: Record<string, EnvironmentRequirement>;
|
|
104
|
+
environmentInputs?: {
|
|
148
105
|
path: string;
|
|
149
106
|
hash: string;
|
|
150
107
|
}[];
|
|
151
|
-
sources?: Record<string, ArtifactSourceMetadata>;
|
|
152
108
|
}
|
|
109
|
+
export type { ArtifactManifest };
|
|
153
110
|
type Properties<S> = S extends {
|
|
154
111
|
properties: infer P;
|
|
155
112
|
} ? P : {};
|
|
@@ -176,4 +133,3 @@ export type InferSchema<S> = S extends {
|
|
|
176
133
|
} & {
|
|
177
134
|
[K in keyof Properties<S> as K extends RequiredKeys<S> ? never : K]?: InferSchema<Properties<S>[K]>;
|
|
178
135
|
} : unknown;
|
|
179
|
-
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Folder composition and logical mounts
|
|
2
|
+
|
|
3
|
+
`explosion/ccdd.json` owns the parent's tools and Critics. The nearest marked children, `effect` and `preview`, remain separate Artifacts. The parent automatically depends on both. `style` and `theme` are logical mounts to sibling Artifacts; no directories, copies or symlinks are created for them.
|
|
4
|
+
|
|
5
|
+
Install `@ccdd/core`, `@ccdd/project` and `@ccdd/default-tools` in this directory, then run:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
ccdd-project config check
|
|
9
|
+
ccdd-project graph explosion --json
|
|
10
|
+
ccdd-project tools check --artifact explosion --for agent --tool blind_pair --execute
|
|
11
|
+
ccdd-project verify explosion --recursive --wait
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
The last command uses real Agent evaluation. No verdict is included in this example. The theme and screenshot intentionally use the same supplied sample image; replace them before using this as a project criterion.
|
|
15
|
+
|
|
16
|
+
The coding-style Critic references `{style}` through the existing instruction template. The blind comparison procedure is a normal user script: it resolves the theme mount and preview child, randomizes A/B, returns images, and writes its private mapping to the external output directory. The Critic instructs its reviewer not to open named views. That is a review procedure, not an access-control guarantee against a reviewer who deliberately ignores it. CCDD adds no presentation-specific runner. The other Critic demonstrates direct `{effect}` and `{preview}` references.
|
|
17
|
+
|
|
18
|
+
Repeated mounts share the canonical Artifact and its evidence. Each Artifact controls its own tools; parent declarations do not merge child Critics or views.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "coding-style",
|
|
3
|
+
"views": {
|
|
4
|
+
"agentTools": {
|
|
5
|
+
"read": {
|
|
6
|
+
"metadata": {
|
|
7
|
+
"description": "Inspect {artifactName} with read.",
|
|
8
|
+
"inputSchema": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"properties": {
|
|
11
|
+
"path": {
|
|
12
|
+
"type": "string"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"additionalProperties": false,
|
|
16
|
+
"required": [
|
|
17
|
+
"path"
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"resultKinds": [
|
|
21
|
+
"json"
|
|
22
|
+
],
|
|
23
|
+
"observation": "content",
|
|
24
|
+
"executionPaths": [
|
|
25
|
+
"node_modules/@ccdd/core/dist",
|
|
26
|
+
"node_modules/@ccdd/default-tools/dist"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"script": {
|
|
30
|
+
"command": "ccdd-view",
|
|
31
|
+
"args": [
|
|
32
|
+
"read"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"list": {
|
|
37
|
+
"metadata": {
|
|
38
|
+
"description": "Inspect {artifactName} with list.",
|
|
39
|
+
"inputSchema": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"properties": {
|
|
42
|
+
"path": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
},
|
|
48
|
+
"resultKinds": [
|
|
49
|
+
"json"
|
|
50
|
+
],
|
|
51
|
+
"observation": "none",
|
|
52
|
+
"executionPaths": [
|
|
53
|
+
"node_modules/@ccdd/core/dist",
|
|
54
|
+
"node_modules/@ccdd/default-tools/dist"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
"script": {
|
|
58
|
+
"command": "ccdd-view",
|
|
59
|
+
"args": [
|
|
60
|
+
"list"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"image": {
|
|
65
|
+
"metadata": {
|
|
66
|
+
"description": "Inspect {artifactName} with image.",
|
|
67
|
+
"inputSchema": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"properties": {
|
|
70
|
+
"path": {
|
|
71
|
+
"type": "string"
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"required": [
|
|
76
|
+
"path"
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
"resultKinds": [
|
|
80
|
+
"image"
|
|
81
|
+
],
|
|
82
|
+
"observation": "content",
|
|
83
|
+
"executionPaths": [
|
|
84
|
+
"node_modules/@ccdd/core/dist",
|
|
85
|
+
"node_modules/@ccdd/default-tools/dist"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"script": {
|
|
89
|
+
"command": "ccdd-view",
|
|
90
|
+
"args": [
|
|
91
|
+
"image"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"humanTools": {
|
|
97
|
+
"open": {
|
|
98
|
+
"metadata": {
|
|
99
|
+
"description": "Inspect {artifactName} with open.",
|
|
100
|
+
"inputSchema": {
|
|
101
|
+
"type": "object",
|
|
102
|
+
"properties": {
|
|
103
|
+
"path": {
|
|
104
|
+
"type": "string"
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"additionalProperties": false
|
|
108
|
+
},
|
|
109
|
+
"resultKinds": [
|
|
110
|
+
"launch"
|
|
111
|
+
],
|
|
112
|
+
"observation": "none",
|
|
113
|
+
"executionPaths": [
|
|
114
|
+
"node_modules/@ccdd/core/dist",
|
|
115
|
+
"node_modules/@ccdd/default-tools/dist"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"script": {
|
|
119
|
+
"command": "ccdd-view",
|
|
120
|
+
"args": [
|
|
121
|
+
"open"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"basis": true
|
|
128
|
+
}
|