@peterxiaoyang/superspec 0.1.14 → 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 -60
- 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 -404
- 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 -1767
- package/dist/src/packet_schema.d.ts +0 -59
- 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 -33
- package/dist/src/project_init.js +0 -191
- 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
package/dist/src/hooks/health.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { reason, sha256_file } from "../util.js";
|
|
4
|
-
import { HOOK_ADAPTER_VERSION } from "./types.js";
|
|
5
|
-
const HOOK_COMMAND = 'superspec-hook --change "$SUPERSPEC_CHANGE"';
|
|
6
|
-
const EXPECTED_HOOK_MATRIX = [
|
|
7
|
-
{
|
|
8
|
-
eventName: "SubagentStart",
|
|
9
|
-
matcher: ".*",
|
|
10
|
-
timeout: 120,
|
|
11
|
-
statusMessage: "SuperSpec 子智能体启动记录",
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
eventName: "SubagentStop",
|
|
15
|
-
matcher: ".*",
|
|
16
|
-
timeout: 120,
|
|
17
|
-
statusMessage: "SuperSpec 子智能体停止记录",
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
function isRecord(value) {
|
|
21
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
22
|
-
}
|
|
23
|
-
function hasExactKeys(value, keys) {
|
|
24
|
-
const actual = Object.keys(value).sort();
|
|
25
|
-
const expected = [...keys].sort();
|
|
26
|
-
return actual.length === expected.length && actual.every((key, index) => key === expected[index]);
|
|
27
|
-
}
|
|
28
|
-
function hookEntryMatches(entry, expected) {
|
|
29
|
-
if (entry.matcher !== expected.matcher)
|
|
30
|
-
return false;
|
|
31
|
-
if (!Array.isArray(entry.hooks) || entry.hooks.length !== 1)
|
|
32
|
-
return false;
|
|
33
|
-
const hook = entry.hooks[0];
|
|
34
|
-
if (!isRecord(hook))
|
|
35
|
-
return false;
|
|
36
|
-
if (!hasExactKeys(hook, ["type", "command", "timeout", "statusMessage"]))
|
|
37
|
-
return false;
|
|
38
|
-
return hook.type === "command"
|
|
39
|
-
&& hook.command === HOOK_COMMAND
|
|
40
|
-
&& hook.timeout === expected.timeout
|
|
41
|
-
&& hook.statusMessage === expected.statusMessage;
|
|
42
|
-
}
|
|
43
|
-
function hookMatrixPresent(parsed) {
|
|
44
|
-
const hooks = parsed?.hooks;
|
|
45
|
-
if (!hooks || typeof hooks !== "object")
|
|
46
|
-
return false;
|
|
47
|
-
if (!isRecord(hooks))
|
|
48
|
-
return false;
|
|
49
|
-
if (!hasExactKeys(hooks, EXPECTED_HOOK_MATRIX.map((entry) => entry.eventName)))
|
|
50
|
-
return false;
|
|
51
|
-
return EXPECTED_HOOK_MATRIX.every((expected) => {
|
|
52
|
-
const entries = hooks[expected.eventName];
|
|
53
|
-
return Array.isArray(entries)
|
|
54
|
-
&& entries.length === 1
|
|
55
|
-
&& hookEntryMatches(entries[0], expected);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
export function hookManifestHash(repoRoot) {
|
|
59
|
-
const hookPath = join(repoRoot, ".codex", "hooks.json");
|
|
60
|
-
if (!existsSync(hookPath) || !statSync(hookPath).isFile())
|
|
61
|
-
return null;
|
|
62
|
-
return sha256_file(hookPath);
|
|
63
|
-
}
|
|
64
|
-
export function managedHooksManifestPresent(repoRoot) {
|
|
65
|
-
const hookPath = join(repoRoot, ".codex", "hooks.json");
|
|
66
|
-
if (!existsSync(hookPath) || !statSync(hookPath).isFile())
|
|
67
|
-
return false;
|
|
68
|
-
try {
|
|
69
|
-
const parsed = JSON.parse(readFileSync(hookPath, "utf8"));
|
|
70
|
-
return parsed?.superspec?.managed === true
|
|
71
|
-
&& parsed?.superspec?.adapter_version === HOOK_ADAPTER_VERSION
|
|
72
|
-
&& parsed?.superspec?.strict_profile_default === "audit-only-until-r1-provenance-passes"
|
|
73
|
-
&& hookMatrixPresent(parsed);
|
|
74
|
-
}
|
|
75
|
-
catch {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export function hookInitReasons(repoRoot) {
|
|
80
|
-
const hookPath = join(repoRoot, ".codex", "hooks.json");
|
|
81
|
-
if (!existsSync(hookPath))
|
|
82
|
-
return [];
|
|
83
|
-
if (managedHooksManifestPresent(repoRoot))
|
|
84
|
-
return [];
|
|
85
|
-
return [reason("hook_manifest_unmanaged", ".codex/hooks.json exists but is not the SuperSpec-managed v2 hook manifest; strict profile must downgrade")];
|
|
86
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { JsonMap, Reason } from "../util.ts";
|
|
2
|
-
import type { HookEvent } from "./types.ts";
|
|
3
|
-
export type NormalizedHookEvent = {
|
|
4
|
-
event: HookEvent;
|
|
5
|
-
hook_event_id: string;
|
|
6
|
-
hook_event_name: string;
|
|
7
|
-
session_id: string;
|
|
8
|
-
cwd: string;
|
|
9
|
-
tool_name: string;
|
|
10
|
-
command: string;
|
|
11
|
-
};
|
|
12
|
-
export type WriteExtraction = {
|
|
13
|
-
target_paths: string[];
|
|
14
|
-
trust_root_text_matches: string[];
|
|
15
|
-
archive_command: boolean;
|
|
16
|
-
internal_hook_writer_command: boolean;
|
|
17
|
-
unsafe_lifecycle_termination_command: boolean;
|
|
18
|
-
unsupported_write_surface: boolean;
|
|
19
|
-
task_checkbox_completions: string[];
|
|
20
|
-
task_checkbox_reopens: string[];
|
|
21
|
-
shell_write_command: boolean;
|
|
22
|
-
reasons: Reason[];
|
|
23
|
-
};
|
|
24
|
-
export declare function readHookEventRef(eventRef: string): HookEvent;
|
|
25
|
-
export declare function normalizeHookEvent(event: HookEvent): NormalizedHookEvent;
|
|
26
|
-
export declare function cleanRelPath(pathValue: string): string;
|
|
27
|
-
export declare function pathsIntersect(a: string, b: string): boolean;
|
|
28
|
-
export declare function isSuperSpecTrustRootPath(pathValue: string, opts?: {
|
|
29
|
-
changeRootRel?: string;
|
|
30
|
-
}): boolean;
|
|
31
|
-
export declare function anyPathInScope(paths: string[], scope: string): boolean;
|
|
32
|
-
export declare function commandLooksLikeTestValidation(command: string, depth?: number): boolean;
|
|
33
|
-
export declare function extractWriteIntent(event: HookEvent, repoRoot: string): WriteExtraction;
|
|
34
|
-
export declare function eventContentHash(event: HookEvent): string;
|
|
35
|
-
export declare function nonce(): string;
|
|
36
|
-
export declare function relFromChangeOrRepo(repoRoot: string, changeRoot: string, pathValue: string): {
|
|
37
|
-
root: "repo" | "change";
|
|
38
|
-
path: string;
|
|
39
|
-
} | null;
|
|
40
|
-
export declare function pinnedFileRef(baseRoot: string, relPath: string): JsonMap | null;
|
|
41
|
-
export declare function renderReasons(reasons: Reason[]): string;
|