@peterxiaoyang/superspec 0.1.13 → 0.1.15-alpha
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/dist/cli.d.ts +2 -0
- package/dist/cli.js +302 -0
- package/dist/format.d.ts +29 -0
- package/dist/format.js +141 -0
- package/dist/next.d.ts +3 -0
- package/dist/next.js +161 -0
- package/dist/openspec.d.ts +9 -0
- package/dist/openspec.js +41 -0
- package/dist/record.d.ts +20 -0
- package/dist/record.js +211 -0
- package/dist/skill_loop.d.ts +23 -0
- package/dist/skill_loop.js +58 -0
- package/dist/store.d.ts +31 -0
- package/dist/store.js +213 -0
- package/dist/sync.d.ts +3 -0
- package/dist/sync.js +135 -0
- package/dist/task.d.ts +7 -0
- package/dist/task.js +44 -0
- package/dist/transition.d.ts +34 -0
- package/dist/transition.js +400 -0
- package/dist/types.d.ts +138 -0
- package/dist/types.js +3 -0
- package/package.json +8 -53
- package/templates/workflow/skills/superspec-apply/SKILL.md +46 -118
- package/templates/workflow/skills/superspec-archive/SKILL.md +22 -47
- package/templates/workflow/skills/superspec-explore/SKILL.md +38 -69
- package/templates/workflow/skills/superspec-propose/SKILL.md +58 -57
- package/templates/workflow/skills/superspec-review/SKILL.md +36 -81
- package/adapters/codex/agents/architect.toml +0 -13
- package/adapters/codex/agents/code-reviewer.toml +0 -13
- package/adapters/codex/agents/critic.toml +0 -13
- package/adapters/codex/agents/executor.toml +0 -13
- package/adapters/codex/agents/explore.toml +0 -13
- package/adapters/codex/agents/test-engineer.toml +0 -13
- package/adapters/codex/agents/test-runner.toml +0 -13
- package/adapters/codex/agents/verifier.toml +0 -13
- package/adapters/codex/install-map.json +0 -116
- package/bin/launch.js +0 -37
- package/bin/superspec-check.js +0 -4
- package/bin/superspec-hook.js +0 -4
- package/bin/superspec-init.js +0 -4
- package/bin/superspec.js +0 -4
- package/dist/src/apply_worker_chain.d.ts +0 -60
- package/dist/src/apply_worker_chain.js +0 -1283
- package/dist/src/apply_worker_chain_lifecycle.d.ts +0 -21
- package/dist/src/apply_worker_chain_lifecycle.js +0 -409
- package/dist/src/archive.d.ts +0 -23
- package/dist/src/archive.js +0 -430
- package/dist/src/cli.d.ts +0 -1
- package/dist/src/cli.js +0 -33
- package/dist/src/cli_args.d.ts +0 -32
- package/dist/src/cli_args.js +0 -454
- package/dist/src/core.d.ts +0 -20
- package/dist/src/core.js +0 -394
- package/dist/src/disclosure.d.ts +0 -35
- package/dist/src/disclosure.js +0 -671
- package/dist/src/doctor.d.ts +0 -44
- package/dist/src/doctor.js +0 -230
- package/dist/src/evidence.d.ts +0 -29
- package/dist/src/evidence.js +0 -1107
- package/dist/src/gates.d.ts +0 -19
- package/dist/src/gates.js +0 -1631
- package/dist/src/git.d.ts +0 -8
- package/dist/src/git.js +0 -112
- package/dist/src/hooks/adapter.d.ts +0 -5
- package/dist/src/hooks/adapter.js +0 -347
- package/dist/src/hooks/guard_api.d.ts +0 -12
- package/dist/src/hooks/guard_api.js +0 -797
- package/dist/src/hooks/health.d.ts +0 -4
- package/dist/src/hooks/health.js +0 -86
- package/dist/src/hooks/policy_event.d.ts +0 -41
- package/dist/src/hooks/policy_event.js +0 -2634
- package/dist/src/hooks/types.d.ts +0 -72
- package/dist/src/hooks/types.js +0 -1
- package/dist/src/hooks/validation.d.ts +0 -3
- package/dist/src/hooks/validation.js +0 -70
- package/dist/src/i18n.d.ts +0 -21
- package/dist/src/i18n.js +0 -720
- package/dist/src/init_cli.d.ts +0 -28
- package/dist/src/init_cli.js +0 -399
- package/dist/src/install_engine.d.ts +0 -71
- package/dist/src/install_engine.js +0 -538
- package/dist/src/invariants.d.ts +0 -16
- package/dist/src/invariants.js +0 -363
- package/dist/src/openspec.d.ts +0 -37
- package/dist/src/openspec.js +0 -274
- package/dist/src/packet_render.d.ts +0 -5
- package/dist/src/packet_render.js +0 -1759
- package/dist/src/packet_schema.d.ts +0 -58
- package/dist/src/packet_schema.js +0 -1
- package/dist/src/paths.d.ts +0 -22
- package/dist/src/paths.js +0 -203
- package/dist/src/project_init.d.ts +0 -31
- package/dist/src/project_init.js +0 -167
- package/dist/src/self_update.d.ts +0 -14
- package/dist/src/self_update.js +0 -56
- package/dist/src/state.d.ts +0 -37
- package/dist/src/state.js +0 -464
- package/dist/src/tasks.d.ts +0 -38
- package/dist/src/tasks.js +0 -373
- package/dist/src/util.d.ts +0 -163
- package/dist/src/util.js +0 -792
- package/dist/superspec.d.ts +0 -6
- package/dist/superspec.js +0 -97
- package/dist/superspec_guard.d.ts +0 -4
- package/dist/superspec_guard.js +0 -19
- package/dist/superspec_hook.d.ts +0 -4
- package/dist/superspec_hook.js +0 -35
- package/dist/superspec_init.d.ts +0 -2
- package/dist/superspec_init.js +0 -17
- package/schemas/hook-event.schema.json +0 -27
- package/schemas/install-manifest.schema.json +0 -97
- package/templates/hooks/codex-hooks.json +0 -35
- package/templates/sidecar/archive-preservation.json +0 -11
- package/templates/sidecar/business-invariants.md +0 -38
- package/templates/sidecar/config.yaml +0 -13
- package/templates/sidecar/discovery.md +0 -33
- package/templates/sidecar/test-contract.md +0 -27
- package/templates/workflow/prompts/architect.md +0 -27
- package/templates/workflow/prompts/code-reviewer.md +0 -34
- package/templates/workflow/prompts/critic.md +0 -30
- package/templates/workflow/prompts/executor.md +0 -32
- package/templates/workflow/prompts/explore.md +0 -27
- package/templates/workflow/prompts/test-engineer.md +0 -28
- package/templates/workflow/prompts/test-runner.md +0 -35
- package/templates/workflow/prompts/verifier.md +0 -35
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type { JsonMap, Reason } from "../util.ts";
|
|
2
|
-
export declare const HOOK_ADAPTER_VERSION = "superspec-hook@2";
|
|
3
|
-
export type HookTrust = "trusted" | "audit-only" | "untrusted";
|
|
4
|
-
export type HookStrictProfile = "available" | "unavailable";
|
|
5
|
-
export type HookEvent = JsonMap & {
|
|
6
|
-
hook_event_name?: string;
|
|
7
|
-
session_id?: string;
|
|
8
|
-
turn_id?: string;
|
|
9
|
-
cwd?: string;
|
|
10
|
-
tool_name?: string;
|
|
11
|
-
tool_use_id?: string;
|
|
12
|
-
tool_input?: JsonMap;
|
|
13
|
-
tool_response?: JsonMap;
|
|
14
|
-
agent_id?: string;
|
|
15
|
-
agent_type?: string;
|
|
16
|
-
};
|
|
17
|
-
export type HookDecision = {
|
|
18
|
-
allowed: boolean;
|
|
19
|
-
decision: "allow" | "block" | "status";
|
|
20
|
-
change_id: string;
|
|
21
|
-
gate: string;
|
|
22
|
-
strict_profile: HookStrictProfile;
|
|
23
|
-
enforcement: "pass-through" | "guarded" | "deny" | "audit-only";
|
|
24
|
-
trust: HookTrust;
|
|
25
|
-
block_reasons: Reason[];
|
|
26
|
-
audit_only_reasons: Reason[];
|
|
27
|
-
target_paths?: string[];
|
|
28
|
-
tool_name?: string;
|
|
29
|
-
hook_event_name?: string;
|
|
30
|
-
hook_event_id?: string;
|
|
31
|
-
actions?: JsonMap[];
|
|
32
|
-
next_allowed_actions: string[];
|
|
33
|
-
trust_warnings: string[];
|
|
34
|
-
};
|
|
35
|
-
export type HookSessionRecord = {
|
|
36
|
-
schema_version: 2;
|
|
37
|
-
kind: "hook_active_session";
|
|
38
|
-
trust: HookTrust;
|
|
39
|
-
change_id: string;
|
|
40
|
-
repo_root: string;
|
|
41
|
-
session_id: string;
|
|
42
|
-
workflow: string;
|
|
43
|
-
started_at: string;
|
|
44
|
-
expires_at: string;
|
|
45
|
-
guard_version: string;
|
|
46
|
-
adapter_version: string;
|
|
47
|
-
hook_manifest_hash: string | null;
|
|
48
|
-
strict_profile: HookStrictProfile;
|
|
49
|
-
audit_only_reasons: Reason[];
|
|
50
|
-
};
|
|
51
|
-
export type HookRunlogRecord = {
|
|
52
|
-
schema_version: 2;
|
|
53
|
-
kind: "subagent_start" | "subagent_stop";
|
|
54
|
-
trust: HookTrust;
|
|
55
|
-
hook_event_id: string;
|
|
56
|
-
hook_event_name: string;
|
|
57
|
-
hook_provenance: JsonMap;
|
|
58
|
-
session_id: string;
|
|
59
|
-
turn_id?: string;
|
|
60
|
-
run_id: string;
|
|
61
|
-
agent_id: string;
|
|
62
|
-
agent_type: string;
|
|
63
|
-
cwd?: string;
|
|
64
|
-
prompt_hash?: string;
|
|
65
|
-
prompt_ref?: string;
|
|
66
|
-
output_ref?: string;
|
|
67
|
-
output_hash?: string;
|
|
68
|
-
status?: string;
|
|
69
|
-
error?: string;
|
|
70
|
-
started_at?: string;
|
|
71
|
-
stopped_at?: string;
|
|
72
|
-
};
|
package/dist/src/hooks/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const HOOK_ADAPTER_VERSION = "superspec-hook@2";
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { isObject, reason, safe_within, sha256_file } from "../util.js";
|
|
4
|
-
import { superspec_dir } from "../paths.js";
|
|
5
|
-
function runlogPath(changeRoot) {
|
|
6
|
-
return join(superspec_dir(changeRoot), "subagent-runlog.jsonl");
|
|
7
|
-
}
|
|
8
|
-
export function strictRoleRunlogReasons(changeRoot, ev) {
|
|
9
|
-
if (ev.trust !== "runtime-verified" && ev.requires_hook_runlog !== true)
|
|
10
|
-
return [];
|
|
11
|
-
const problems = [
|
|
12
|
-
reason("hook_runlog_strict_profile_unavailable", `${ev._path}: strict hook runlog validation is unavailable until R-1 deny and hook provenance pass`),
|
|
13
|
-
];
|
|
14
|
-
const target = runlogPath(changeRoot);
|
|
15
|
-
if (!existsSync(target) || !statSync(target).isFile()) {
|
|
16
|
-
problems.push(reason("hook_runlog_missing", `${ev._path}: strict role evidence requires SuperSpec hook subagent runlog`));
|
|
17
|
-
return problems;
|
|
18
|
-
}
|
|
19
|
-
const records = readFileSync(target, "utf8").split(/\r?\n/u).filter(Boolean).flatMap((line) => {
|
|
20
|
-
try {
|
|
21
|
-
const parsed = JSON.parse(line);
|
|
22
|
-
return isObject(parsed) ? [parsed] : [];
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
const agentId = String(ev.agent_id ?? "");
|
|
29
|
-
const role = String(ev.agent_role ?? "");
|
|
30
|
-
const starts = records.filter((item) => item.kind === "subagent_start" && item.agent_id === agentId && item.agent_type === role && item.trust === "trusted");
|
|
31
|
-
const stops = records.filter((item) => item.kind === "subagent_stop" && item.agent_id === agentId && item.agent_type === role && item.trust === "trusted");
|
|
32
|
-
if (starts.length === 0)
|
|
33
|
-
problems.push(reason("hook_runlog_start_missing", `${ev._path}: strict role evidence has no trusted matching SubagentStart`, [agentId]));
|
|
34
|
-
if (stops.length === 0)
|
|
35
|
-
problems.push(reason("hook_runlog_stop_missing", `${ev._path}: strict role evidence has no trusted matching SubagentStop`, [agentId]));
|
|
36
|
-
const outputRef = typeof ev.output_ref === "string" ? ev.output_ref : "";
|
|
37
|
-
const outputPath = outputRef ? safe_within(changeRoot, outputRef) : null;
|
|
38
|
-
const outputSha = outputPath && existsSync(outputPath) && statSync(outputPath).isFile() ? sha256_file(outputPath) : null;
|
|
39
|
-
if (outputSha && stops.length > 0 && !stops.some((item) => item.output_hash === outputSha || item.output_ref === outputRef)) {
|
|
40
|
-
problems.push(reason("hook_runlog_output_mismatch", `${ev._path}: strict role evidence output_ref does not match trusted SubagentStop output hash/ref`, [agentId]));
|
|
41
|
-
}
|
|
42
|
-
return problems;
|
|
43
|
-
}
|
|
44
|
-
export function strictRuntimeEvidenceReasons(ev) {
|
|
45
|
-
if (ev.trust !== "runtime-verified")
|
|
46
|
-
return [];
|
|
47
|
-
const problems = [
|
|
48
|
-
reason("runtime_evidence_strict_profile_unavailable", `${ev._path}: strict runtime evidence is unavailable until R-1 deny and hook provenance pass`),
|
|
49
|
-
];
|
|
50
|
-
if (typeof ev.hook_event_id !== "string" || !ev.hook_event_id)
|
|
51
|
-
problems.push(reason("runtime_evidence_missing_hook_event", `${ev._path}: runtime-verified evidence requires hook_event_id`));
|
|
52
|
-
if (!isObject(ev.hook_provenance) || ev.hook_provenance.validation !== "trusted")
|
|
53
|
-
problems.push(reason("runtime_evidence_untrusted_provenance", `${ev._path}: runtime-verified evidence requires trusted hook_provenance`));
|
|
54
|
-
if (!isObject(ev.token_binding))
|
|
55
|
-
problems.push(reason("runtime_evidence_missing_token", `${ev._path}: runtime-verified evidence requires Guard token_binding`));
|
|
56
|
-
if (typeof ev.command_fingerprint !== "string" || !ev.command_fingerprint.startsWith("sha256:"))
|
|
57
|
-
problems.push(reason("runtime_evidence_missing_command_fingerprint", `${ev._path}: runtime-verified evidence requires command_fingerprint`));
|
|
58
|
-
if (!Array.isArray(ev.raw_log_pinned_refs) || ev.raw_log_pinned_refs.length === 0)
|
|
59
|
-
problems.push(reason("runtime_evidence_missing_raw_log_pin", `${ev._path}: runtime-verified evidence requires raw_log_pinned_refs`));
|
|
60
|
-
if (typeof ev.exit_code !== "number") {
|
|
61
|
-
problems.push(reason("runtime_evidence_missing_exit_code", `${ev._path}: runtime-verified evidence requires numeric exit_code`));
|
|
62
|
-
}
|
|
63
|
-
else if ((ev.kind === "final_test" || ev.semantic_status === "expected_success") && ev.exit_code !== 0) {
|
|
64
|
-
problems.push(reason("runtime_evidence_exit_code_mismatch", `${ev._path}: expected_success/final_test runtime evidence requires exit_code=0`));
|
|
65
|
-
}
|
|
66
|
-
else if (ev.semantic_status === "expected_failure" && ev.exit_code === 0) {
|
|
67
|
-
problems.push(reason("runtime_evidence_exit_code_mismatch", `${ev._path}: RED runtime evidence requires non-zero exit_code`));
|
|
68
|
-
}
|
|
69
|
-
return problems;
|
|
70
|
-
}
|
package/dist/src/i18n.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type ZhHint = {
|
|
2
|
-
label_zh: string;
|
|
3
|
-
hint_zh: string;
|
|
4
|
-
};
|
|
5
|
-
export type WorkflowTermHint = {
|
|
6
|
-
term: string;
|
|
7
|
-
label_zh: string;
|
|
8
|
-
hint_zh: string;
|
|
9
|
-
};
|
|
10
|
-
export declare function command_zh(command: string): ZhHint;
|
|
11
|
-
export declare function gate_zh(gate: string): ZhHint;
|
|
12
|
-
export declare function reason_zh(code: string): ZhHint;
|
|
13
|
-
export declare function decision_zh(decision: string): string;
|
|
14
|
-
export declare function translate_action_zh(action: string): string;
|
|
15
|
-
export declare function reason_message_zh(code: string, rawMessage: string, refs?: string[]): string;
|
|
16
|
-
export declare function trust_warning_zh(warning: string): string;
|
|
17
|
-
export declare function action_status_zh(status: string): string;
|
|
18
|
-
export declare function action_label_zh(action: string): string;
|
|
19
|
-
export declare function action_detail_zh(detail: string): string;
|
|
20
|
-
export declare function system_failure_zh(raw: string, fallback?: string): string;
|
|
21
|
-
export declare function workflow_terms_zh_for(command: string | undefined, _gate: string, reasonCodes: string[]): WorkflowTermHint[];
|