ctxr-cli 0.5.0 → 0.7.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/dist/adapter.d.ts +0 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/adapters/builtin/index.d.ts.map +1 -1
- package/dist/adapters/builtin/index.js +2 -2
- package/dist/adapters/builtin/index.js.map +1 -1
- package/dist/adapters/harness/claude-code.d.ts.map +1 -1
- package/dist/adapters/harness/claude-code.js +30 -14
- package/dist/adapters/harness/claude-code.js.map +1 -1
- package/dist/adapters/harness/hermes-agent.d.ts +9 -0
- package/dist/adapters/harness/hermes-agent.d.ts.map +1 -0
- package/dist/adapters/harness/hermes-agent.js +13 -0
- package/dist/adapters/harness/hermes-agent.js.map +1 -0
- package/dist/adapters/types.d.ts +38 -18
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js +3 -3
- package/dist/adapters/types.js.map +1 -1
- package/dist/commands/adapters-generate.d.ts +4 -2
- package/dist/commands/adapters-generate.d.ts.map +1 -1
- package/dist/commands/adapters-generate.js +14 -6
- package/dist/commands/adapters-generate.js.map +1 -1
- package/dist/commands/archive.d.ts +6 -4
- package/dist/commands/archive.d.ts.map +1 -1
- package/dist/commands/archive.js +7 -5
- package/dist/commands/archive.js.map +1 -1
- package/dist/commands/catalog-show.d.ts +0 -1
- package/dist/commands/catalog-show.d.ts.map +1 -1
- package/dist/commands/catalog-show.js +1 -1
- package/dist/commands/catalog-show.js.map +1 -1
- package/dist/commands/graph-query.d.ts +2 -11
- package/dist/commands/graph-query.d.ts.map +1 -1
- package/dist/commands/graph-query.js +11 -14
- package/dist/commands/graph-query.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +82 -21
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/publish-check.d.ts +23 -0
- package/dist/commands/publish-check.d.ts.map +1 -0
- package/dist/commands/publish-check.js +112 -0
- package/dist/commands/publish-check.js.map +1 -0
- package/dist/commands/publish-gather.d.ts +27 -0
- package/dist/commands/publish-gather.d.ts.map +1 -0
- package/dist/commands/publish-gather.js +73 -0
- package/dist/commands/publish-gather.js.map +1 -0
- package/dist/commands/publish-new.d.ts +19 -0
- package/dist/commands/publish-new.d.ts.map +1 -0
- package/dist/commands/publish-new.js +108 -0
- package/dist/commands/publish-new.js.map +1 -0
- package/dist/commands/serve.d.ts +32 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +151 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/session-capture.d.ts.map +1 -1
- package/dist/commands/session-capture.js +0 -2
- package/dist/commands/session-capture.js.map +1 -1
- package/dist/commands/update.js +3 -3
- package/dist/commands/update.js.map +1 -1
- package/dist/config/defaults.d.ts +49 -44
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +49 -47
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/schema.d.ts +53 -52
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +84 -62
- package/dist/config/schema.js.map +1 -1
- package/dist/core/agents-doc.d.ts +9 -0
- package/dist/core/agents-doc.d.ts.map +1 -1
- package/dist/core/agents-doc.js +31 -16
- package/dist/core/agents-doc.js.map +1 -1
- package/dist/core/browse/link-resolver.d.ts +12 -0
- package/dist/core/browse/link-resolver.d.ts.map +1 -0
- package/dist/core/browse/link-resolver.js +12 -0
- package/dist/core/browse/link-resolver.js.map +1 -0
- package/dist/core/browse/nav.d.ts +10 -0
- package/dist/core/browse/nav.d.ts.map +1 -0
- package/dist/core/browse/nav.js +101 -0
- package/dist/core/browse/nav.js.map +1 -0
- package/dist/core/browse/render.d.ts +5 -0
- package/dist/core/browse/render.d.ts.map +1 -0
- package/dist/core/browse/render.js +66 -0
- package/dist/core/browse/render.js.map +1 -0
- package/dist/core/browse/routes.d.ts +40 -0
- package/dist/core/browse/routes.d.ts.map +1 -0
- package/dist/core/browse/routes.js +68 -0
- package/dist/core/browse/routes.js.map +1 -0
- package/dist/core/browse/templates.d.ts +13 -0
- package/dist/core/browse/templates.d.ts.map +1 -0
- package/dist/core/browse/templates.js +39 -0
- package/dist/core/browse/templates.js.map +1 -0
- package/dist/core/browse/tree.d.ts +33 -0
- package/dist/core/browse/tree.d.ts.map +1 -0
- package/dist/core/browse/tree.js +53 -0
- package/dist/core/browse/tree.js.map +1 -0
- package/dist/core/catalog/build.d.ts +1 -1
- package/dist/core/catalog/build.d.ts.map +1 -1
- package/dist/core/catalog/build.js +1 -2
- package/dist/core/catalog/build.js.map +1 -1
- package/dist/core/catalog/model.d.ts +2 -0
- package/dist/core/catalog/model.d.ts.map +1 -1
- package/dist/core/catalog/model.js +2 -1
- package/dist/core/catalog/model.js.map +1 -1
- package/dist/core/checks/integrity-checks.d.ts +18 -2
- package/dist/core/checks/integrity-checks.d.ts.map +1 -1
- package/dist/core/checks/integrity-checks.js +55 -10
- package/dist/core/checks/integrity-checks.js.map +1 -1
- package/dist/core/checks/manifest.d.ts.map +1 -1
- package/dist/core/checks/manifest.js +0 -5
- package/dist/core/checks/manifest.js.map +1 -1
- package/dist/core/checks/organize-checks.d.ts +10 -3
- package/dist/core/checks/organize-checks.d.ts.map +1 -1
- package/dist/core/checks/organize-checks.js +14 -5
- package/dist/core/checks/organize-checks.js.map +1 -1
- package/dist/core/checks/types.d.ts +1 -1
- package/dist/core/convention-doc.d.ts +21 -19
- package/dist/core/convention-doc.d.ts.map +1 -1
- package/dist/core/convention-doc.js +48 -62
- package/dist/core/convention-doc.js.map +1 -1
- package/dist/core/conventions.d.ts +2 -2
- package/dist/core/conventions.js +2 -2
- package/dist/core/errors.d.ts +31 -44
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/core/errors.js +81 -128
- package/dist/core/errors.js.map +1 -1
- package/dist/core/exit-codes.d.ts +7 -5
- package/dist/core/exit-codes.d.ts.map +1 -1
- package/dist/core/exit-codes.js +7 -5
- package/dist/core/exit-codes.js.map +1 -1
- package/dist/core/git/repo.d.ts +0 -6
- package/dist/core/git/repo.d.ts.map +1 -1
- package/dist/core/git/repo.js +0 -13
- package/dist/core/git/repo.js.map +1 -1
- package/dist/core/git/worktree.d.ts +4 -7
- package/dist/core/git/worktree.d.ts.map +1 -1
- package/dist/core/git/worktree.js +4 -10
- package/dist/core/git/worktree.js.map +1 -1
- package/dist/core/graph/model.d.ts +14 -0
- package/dist/core/graph/model.d.ts.map +1 -1
- package/dist/core/graph/model.js +30 -14
- package/dist/core/graph/model.js.map +1 -1
- package/dist/core/harness/bridge.d.ts +30 -0
- package/dist/core/harness/bridge.d.ts.map +1 -0
- package/dist/core/harness/bridge.js +178 -0
- package/dist/core/harness/bridge.js.map +1 -0
- package/dist/core/ingest/identity.d.ts +4 -4
- package/dist/core/ingest/identity.js +4 -4
- package/dist/core/json-config-merge.d.ts.map +1 -1
- package/dist/core/json-config-merge.js +30 -7
- package/dist/core/json-config-merge.js.map +1 -1
- package/dist/core/migrations/add-explanation-craft-skill.d.ts +26 -0
- package/dist/core/migrations/add-explanation-craft-skill.d.ts.map +1 -0
- package/dist/core/migrations/add-explanation-craft-skill.js +94 -0
- package/dist/core/migrations/add-explanation-craft-skill.js.map +1 -0
- package/dist/core/migrations/archive-destination-from-taxonomy.d.ts +35 -0
- package/dist/core/migrations/archive-destination-from-taxonomy.d.ts.map +1 -0
- package/dist/core/migrations/archive-destination-from-taxonomy.js +109 -0
- package/dist/core/migrations/archive-destination-from-taxonomy.js.map +1 -0
- package/dist/core/migrations/drop-access-axes.d.ts +24 -0
- package/dist/core/migrations/drop-access-axes.d.ts.map +1 -0
- package/dist/core/migrations/drop-access-axes.js +54 -0
- package/dist/core/migrations/drop-access-axes.js.map +1 -0
- package/dist/core/migrations/drop-forge-and-workspaces-external.d.ts +19 -0
- package/dist/core/migrations/drop-forge-and-workspaces-external.d.ts.map +1 -0
- package/dist/core/migrations/drop-forge-and-workspaces-external.js +49 -0
- package/dist/core/migrations/drop-forge-and-workspaces-external.js.map +1 -0
- package/dist/core/migrations/registry.d.ts +11 -1
- package/dist/core/migrations/registry.d.ts.map +1 -1
- package/dist/core/migrations/registry.js +19 -3
- package/dist/core/migrations/registry.js.map +1 -1
- package/dist/core/notes/list.d.ts +1 -12
- package/dist/core/notes/list.d.ts.map +1 -1
- package/dist/core/notes/list.js +5 -1
- package/dist/core/notes/list.js.map +1 -1
- package/dist/core/publish/script-check.d.ts +12 -0
- package/dist/core/publish/script-check.d.ts.map +1 -0
- package/dist/core/publish/script-check.js +39 -0
- package/dist/core/publish/script-check.js.map +1 -0
- package/dist/core/reconcile.d.ts +3 -0
- package/dist/core/reconcile.d.ts.map +1 -1
- package/dist/core/reconcile.js +15 -5
- package/dist/core/reconcile.js.map +1 -1
- package/dist/core/records.d.ts +4 -5
- package/dist/core/records.d.ts.map +1 -1
- package/dist/core/records.js +0 -2
- package/dist/core/records.js.map +1 -1
- package/dist/core/session.d.ts +9 -9
- package/dist/core/session.js +9 -9
- package/dist/core/skills.d.ts +42 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +159 -31
- package/dist/core/skills.js.map +1 -1
- package/dist/core/write-lifecycle/path-gate.d.ts.map +1 -1
- package/dist/core/write-lifecycle/path-gate.js +4 -2
- package/dist/core/write-lifecycle/path-gate.js.map +1 -1
- package/dist/prompt/inquirer-prompter.d.ts.map +1 -1
- package/dist/prompt/inquirer-prompter.js +11 -1
- package/dist/prompt/inquirer-prompter.js.map +1 -1
- package/dist/prompt/prompter.d.ts +16 -0
- package/dist/prompt/prompter.d.ts.map +1 -1
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +69 -101
- package/dist/run.js.map +1 -1
- package/dist/taxonomy/profiles.d.ts +11 -0
- package/dist/taxonomy/profiles.d.ts.map +1 -1
- package/dist/taxonomy/profiles.js +1 -0
- package/dist/taxonomy/profiles.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -1
- package/templates/agents/canonical.md +1 -3
- package/templates/conventions/baseline-conventions.md +27 -0
- package/templates/conventions/{custom-convention-seed.md → house-conventions-seed.md} +15 -2
- package/templates/hooks/pre-push.sh +1 -1
- package/templates/serve/shell.html +18 -0
- package/templates/serve/style.css +163 -0
- package/templates/skills/ctxr-land.md +32 -18
- package/templates/skills/ctxr-organize-audit.md +2 -10
- package/templates/skills/ctxr-placement.md +6 -24
- package/templates/skills/ctxr-publish.md +84 -0
- package/templates/skills/ctxr-session-capture.md +43 -3
- package/templates/skills/ctxr-session-lifecycle.md +20 -1
- package/templates/skills/ctxr-submit.md +15 -11
- package/templates/vendor/eli5/LICENSE.txt +21 -0
- package/templates/vendor/eli5/SKILL.md +116 -0
- package/templates/vendor/eli5/provenance.json +8 -0
- package/templates/vendor/frontend-design/LICENSE.txt +177 -0
- package/templates/vendor/frontend-design/SKILL.md +55 -0
- package/templates/vendor/frontend-design/provenance.json +7 -0
- package/dist/adapters/forge/github.d.ts +0 -12
- package/dist/adapters/forge/github.d.ts.map +0 -1
- package/dist/adapters/forge/github.js +0 -76
- package/dist/adapters/forge/github.js.map +0 -1
- package/dist/adapters/forge/types.d.ts +0 -46
- package/dist/adapters/forge/types.d.ts.map +0 -1
- package/dist/adapters/forge/types.js +0 -2
- package/dist/adapters/forge/types.js.map +0 -1
- package/dist/commands/check.d.ts +0 -30
- package/dist/commands/check.d.ts.map +0 -1
- package/dist/commands/check.js +0 -70
- package/dist/commands/check.js.map +0 -1
- package/dist/commands/note-resolve.d.ts +0 -14
- package/dist/commands/note-resolve.d.ts.map +0 -1
- package/dist/commands/note-resolve.js +0 -24
- package/dist/commands/note-resolve.js.map +0 -1
- package/dist/commands/session-abandon.d.ts +0 -13
- package/dist/commands/session-abandon.d.ts.map +0 -1
- package/dist/commands/session-abandon.js +0 -22
- package/dist/commands/session-abandon.js.map +0 -1
- package/dist/commands/session-land.d.ts +0 -45
- package/dist/commands/session-land.d.ts.map +0 -1
- package/dist/commands/session-land.js +0 -171
- package/dist/commands/session-land.js.map +0 -1
- package/dist/commands/session-reap.d.ts +0 -22
- package/dist/commands/session-reap.d.ts.map +0 -1
- package/dist/commands/session-reap.js +0 -52
- package/dist/commands/session-reap.js.map +0 -1
- package/dist/commands/session-submit.d.ts +0 -29
- package/dist/commands/session-submit.d.ts.map +0 -1
- package/dist/commands/session-submit.js +0 -72
- package/dist/commands/session-submit.js.map +0 -1
- package/dist/core/checks/disclosure-checks.d.ts +0 -4
- package/dist/core/checks/disclosure-checks.d.ts.map +0 -1
- package/dist/core/checks/disclosure-checks.js +0 -24
- package/dist/core/checks/disclosure-checks.js.map +0 -1
- package/dist/core/disclosure/leak-scan.d.ts +0 -19
- package/dist/core/disclosure/leak-scan.d.ts.map +0 -1
- package/dist/core/disclosure/leak-scan.js +0 -31
- package/dist/core/disclosure/leak-scan.js.map +0 -1
- package/dist/core/disclosure/model.d.ts +0 -18
- package/dist/core/disclosure/model.d.ts.map +0 -1
- package/dist/core/disclosure/model.js +0 -45
- package/dist/core/disclosure/model.js.map +0 -1
- package/dist/core/graph/visibility-filter.d.ts +0 -13
- package/dist/core/graph/visibility-filter.d.ts.map +0 -1
- package/dist/core/graph/visibility-filter.js +0 -26
- package/dist/core/graph/visibility-filter.js.map +0 -1
- package/dist/core/migrations/rename-visibility-field.d.ts +0 -3
- package/dist/core/migrations/rename-visibility-field.d.ts.map +0 -1
- package/dist/core/migrations/rename-visibility-field.js +0 -62
- package/dist/core/migrations/rename-visibility-field.js.map +0 -1
- package/dist/core/notes/checks.d.ts +0 -20
- package/dist/core/notes/checks.d.ts.map +0 -1
- package/dist/core/notes/checks.js +0 -58
- package/dist/core/notes/checks.js.map +0 -1
- package/dist/core/notes/visibility.d.ts +0 -26
- package/dist/core/notes/visibility.d.ts.map +0 -1
- package/dist/core/notes/visibility.js +0 -41
- package/dist/core/notes/visibility.js.map +0 -1
- package/templates/conventions/baseline-convention.md +0 -60
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { SessionReapWorkspacesExternalError } from '../core/errors.js';
|
|
2
|
-
import { ExitCode } from '../core/exit-codes.js';
|
|
3
|
-
import { isWorkingTreeClean } from '../core/git/repo.js';
|
|
4
|
-
import { deleteBranch, listWorktrees, removeWorktree } from '../core/git/worktree.js';
|
|
5
|
-
import { isSessionBranch, isSessionWorktreePath } from '../core/session.js';
|
|
6
|
-
export const requires = { store: 'required' };
|
|
7
|
-
/**
|
|
8
|
-
* write-lifecycle spec: reclaims session worktrees whose branch has been
|
|
9
|
-
* merged into the default branch and whose tree is clean — never a branch
|
|
10
|
-
* with unmerged commits, never a dirty worktree. This removes the
|
|
11
|
-
* concurrency race entirely rather than hardening against it: a
|
|
12
|
-
* conservative reap that only ever touches provably-safe sessions.
|
|
13
|
-
*/
|
|
14
|
-
export async function execute(env, store) {
|
|
15
|
-
if (store.config.session.workspaces_external) {
|
|
16
|
-
throw new SessionReapWorkspacesExternalError();
|
|
17
|
-
}
|
|
18
|
-
const worktrees = await listWorktrees(env.git, store.root);
|
|
19
|
-
const sessions = worktrees.filter((w) => w.branch !== null &&
|
|
20
|
-
(isSessionBranch(store.config, w.branch) || isSessionWorktreePath(store.config, w.path)));
|
|
21
|
-
const reaped = [];
|
|
22
|
-
const skipped = [];
|
|
23
|
-
for (const session of sessions) {
|
|
24
|
-
const clean = await isWorkingTreeClean(env.git, session.path);
|
|
25
|
-
if (!clean) {
|
|
26
|
-
skipped.push({ branch: session.branch, worktree: session.path, reason: 'worktree has uncommitted changes' });
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const aheadResult = await env.git.run(['log', `${store.config.git.default_branch}..${session.branch}`, '--oneline'], { cwd: store.root, allowFailure: true });
|
|
30
|
-
const isMerged = aheadResult.exitCode === 0 && aheadResult.stdout.trim().length === 0;
|
|
31
|
-
if (!isMerged) {
|
|
32
|
-
skipped.push({
|
|
33
|
-
branch: session.branch,
|
|
34
|
-
worktree: session.path,
|
|
35
|
-
reason: 'branch has commits not yet merged into the default branch',
|
|
36
|
-
});
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
await removeWorktree(env.git, store.root, session.path);
|
|
40
|
-
await deleteBranch(env.git, store.root, session.branch);
|
|
41
|
-
reaped.push({ branch: session.branch, worktree: session.path, reason: 'merged and clean' });
|
|
42
|
-
}
|
|
43
|
-
return {
|
|
44
|
-
exitCode: ExitCode.Ok,
|
|
45
|
-
data: { reaped, skipped },
|
|
46
|
-
findings: [],
|
|
47
|
-
humanSummary: `Reaped ${reaped.length} session(s), skipped ${skipped.length}.`,
|
|
48
|
-
storeRoot: store.root,
|
|
49
|
-
schemaVersion: store.config.schema_version,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=session-reap.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-reap.js","sourceRoot":"","sources":["../../src/commands/session-reap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kCAAkC,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACtF,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAG5E,MAAM,CAAC,MAAM,QAAQ,GAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAa/D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,GAAW,EAAE,KAAY;IACrD,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,mBAAmB,EAAE,CAAC;QAC7C,MAAM,IAAI,kCAAkC,EAAE,CAAC;IACjD,CAAC;IAED,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI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,OAAO,CAAC,IAAI;gBACtB,MAAM,EAAE,2DAA2D;aACpE,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,MAAM,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED,OAAO;QACL,QAAQ,EAAE,QAAQ,CAAC,EAAE;QACrB,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;QACzB,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,UAAU,MAAM,CAAC,MAAM,wBAAwB,OAAO,CAAC,MAAM,GAAG;QAC9E,SAAS,EAAE,KAAK,CAAC,IAAI;QACrB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { OpenPullRequestResult } from '../adapters/forge/types.js';
|
|
2
|
-
import type { CommandOutcome, CommandRequires } from '../core/command.js';
|
|
3
|
-
import type { RunEnv } from '../core/env.js';
|
|
4
|
-
import type { Store } from '../core/store.js';
|
|
5
|
-
export declare const requires: CommandRequires;
|
|
6
|
-
export interface SessionSubmitFlags {
|
|
7
|
-
message?: string;
|
|
8
|
-
title?: string;
|
|
9
|
-
body?: string;
|
|
10
|
-
/** session-submit-and-land spec: renames the session branch before pushing, so a generated name never reaches the forge. */
|
|
11
|
-
branch?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface SessionSubmitData {
|
|
14
|
-
branch: string;
|
|
15
|
-
commit: string | null;
|
|
16
|
-
pushed: boolean;
|
|
17
|
-
pr: OpenPullRequestResult | null;
|
|
18
|
-
manualPrInstructions: string | null;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* write-lifecycle spec: "runs full validation, commits, pushes the branch,
|
|
22
|
-
* opens a PR via the configured forge adapter (or degrades per 2.5);
|
|
23
|
-
* refuses to run if validation fails." Full validation here means the same
|
|
24
|
-
* store-scope invariant set doctor runs — not just what's currently staged
|
|
25
|
-
* — because a session's job is to leave the store healthy as a whole, not
|
|
26
|
-
* merely to pass each individual commit's pre-commit gate.
|
|
27
|
-
*/
|
|
28
|
-
export declare function execute(env: RunEnv, store: Store, flags: SessionSubmitFlags): Promise<CommandOutcome<SessionSubmitData>>;
|
|
29
|
-
//# sourceMappingURL=session-submit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-submit.d.ts","sourceRoot":"","sources":["../../src/commands/session-submit.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAIxE,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAO7C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,eAAO,MAAM,QAAQ,EAAE,eAAuC,CAAC;AAE/D,MAAM,WAAW,kBAAkB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4HAA4H;IAC5H,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,OAAO,CAAC;IAChB,EAAE,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACjC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,wBAAsB,OAAO,CAC3B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,kBAAkB,GACxB,OAAO,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAC,CA8D5C"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { configuredAdapters } from '../adapters/registry.js';
|
|
2
|
-
import { CHECKS } from '../core/checks/manifest.js';
|
|
3
|
-
import { overallStatus, runChecks } from '../core/checks/registry.js';
|
|
4
|
-
import { NoRemoteConfiguredError, SessionValidationFailedError } from '../core/errors.js';
|
|
5
|
-
import { ExitCode } from '../core/exit-codes.js';
|
|
6
|
-
import { commitIfStaged, currentBranch, pushBranch, renameCurrentBranch } from '../core/git/repo.js';
|
|
7
|
-
import { hasRemote } from '../core/git/worktree.js';
|
|
8
|
-
import { readGraph } from '../core/graph/persist.js';
|
|
9
|
-
import { listNotes } from '../core/notes/list.js';
|
|
10
|
-
export const requires = { store: 'required' };
|
|
11
|
-
/**
|
|
12
|
-
* write-lifecycle spec: "runs full validation, commits, pushes the branch,
|
|
13
|
-
* opens a PR via the configured forge adapter (or degrades per 2.5);
|
|
14
|
-
* refuses to run if validation fails." Full validation here means the same
|
|
15
|
-
* store-scope invariant set doctor runs — not just what's currently staged
|
|
16
|
-
* — because a session's job is to leave the store healthy as a whole, not
|
|
17
|
-
* merely to pass each individual commit's pre-commit gate.
|
|
18
|
-
*/
|
|
19
|
-
export async function execute(env, store, flags) {
|
|
20
|
-
let branch = await currentBranch(env.git, store.root);
|
|
21
|
-
if (flags.branch && flags.branch !== branch) {
|
|
22
|
-
await renameCurrentBranch(env.git, store.root, flags.branch);
|
|
23
|
-
branch = flags.branch;
|
|
24
|
-
}
|
|
25
|
-
const ctx = {
|
|
26
|
-
storeRoot: store.root,
|
|
27
|
-
config: store.config,
|
|
28
|
-
scope: 'store',
|
|
29
|
-
git: env.git,
|
|
30
|
-
notes: () => listNotes(store.root, store.config),
|
|
31
|
-
graph: () => readGraph(store),
|
|
32
|
-
catalog: async () => undefined,
|
|
33
|
-
};
|
|
34
|
-
const reports = await runChecks(CHECKS, ctx, { scope: 'store', severity: 'invariant' });
|
|
35
|
-
if (overallStatus(reports) === 'fail') {
|
|
36
|
-
throw new SessionValidationFailedError(reports.flatMap((r) => r.result.findings));
|
|
37
|
-
}
|
|
38
|
-
if (!(await hasRemote(env.git, store.root))) {
|
|
39
|
-
throw new NoRemoteConfiguredError();
|
|
40
|
-
}
|
|
41
|
-
const commitSha = await commitIfStaged(env.git, store.root, { kind: 'session', worktree: store.root, branch }, flags.message ?? `chore: submit session ${branch}`);
|
|
42
|
-
await pushBranch(env.git, store.root, branch);
|
|
43
|
-
let pr = null;
|
|
44
|
-
let manualPrInstructions = null;
|
|
45
|
-
// adapters spec: "No forge adapter configured" is a documented degradation,
|
|
46
|
-
// not a crash — the commit-and-push above still completed either way.
|
|
47
|
-
const [forgeAdapter] = configuredAdapters(store.config, 'forge');
|
|
48
|
-
const forgeAvailable = forgeAdapter ? await forgeAdapter.isAvailable(store.root) : false;
|
|
49
|
-
if (forgeAdapter && forgeAvailable) {
|
|
50
|
-
pr = await forgeAdapter.openPullRequest({
|
|
51
|
-
cwd: store.root,
|
|
52
|
-
branch,
|
|
53
|
-
baseBranch: store.config.git.default_branch,
|
|
54
|
-
title: flags.title ?? `Session: ${branch}`,
|
|
55
|
-
body: flags.body ?? '',
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
manualPrInstructions =
|
|
60
|
-
`No forge adapter is configured or reachable. The branch "${branch}" was pushed successfully — ` +
|
|
61
|
-
`open a pull request manually, comparing it against "${store.config.git.default_branch}".`;
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
exitCode: ExitCode.Ok,
|
|
65
|
-
data: { branch, commit: commitSha, pushed: true, pr, manualPrInstructions },
|
|
66
|
-
findings: [],
|
|
67
|
-
humanSummary: pr ? `Opened PR #${pr.number ?? '?'}: ${pr.url}` : (manualPrInstructions ?? ''),
|
|
68
|
-
storeRoot: store.root,
|
|
69
|
-
schemaVersion: store.config.schema_version,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=session-submit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session-submit.js","sourceRoot":"","sources":["../../src/commands/session-submit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAItE,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACrG,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,MAAM,CAAC,MAAM,QAAQ,GAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAkB/D;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,GAAW,EACX,KAAY,EACZ,KAAyB;IAEzB,IAAI,MAAM,GAAG,MAAM,aAAa,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;QAC5C,MAAM,mBAAmB,CAA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AAI,EAAE,CAAC;QAC7F,SAAS,EAAE,KAAK,CAAC,IAAI;QACrB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc;KAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/** disclosure-policy spec (store-primitives-from-migration-audit D3): reported by lint, never failed by doctor — a marker match is a judgment call, not an invariant. */
|
|
2
|
-
export declare const leakCheck: import("./types.js").CheckDefinition;
|
|
3
|
-
export declare const DISCLOSURE_CHECKS: import("./types.js").CheckDefinition[];
|
|
4
|
-
//# sourceMappingURL=disclosure-checks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure-checks.d.ts","sourceRoot":"","sources":["../../../src/core/checks/disclosure-checks.ts"],"names":[],"mappings":"AAIA,yKAAyK;AACzK,eAAO,MAAM,SAAS,sCAkBpB,CAAC;AAEH,eAAO,MAAM,iBAAiB,wCAAc,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { scanForLeaks } from '../disclosure/leak-scan.js';
|
|
2
|
-
import { defineCheck } from './types.js';
|
|
3
|
-
/** disclosure-policy spec (store-primitives-from-migration-audit D3): reported by lint, never failed by doctor — a marker match is a judgment call, not an invariant. */
|
|
4
|
-
export const leakCheck = defineCheck({
|
|
5
|
-
id: 'disclosure.leak',
|
|
6
|
-
title: "Content matching a context's marker found inside a note that context cannot see",
|
|
7
|
-
severity: 'observation',
|
|
8
|
-
capability: 'disclosure-policy',
|
|
9
|
-
scopes: ['store'],
|
|
10
|
-
async run(ctx) {
|
|
11
|
-
const notes = await ctx.notes();
|
|
12
|
-
const leaks = scanForLeaks(ctx.config, notes);
|
|
13
|
-
const findings = leaks.map((leak) => ({
|
|
14
|
-
code: 'disclosure.leak',
|
|
15
|
-
severity: 'warning',
|
|
16
|
-
message: `"${leak.path}" matches a marker for context "${leak.context}", which cannot see this note: "${leak.matchedText}".`,
|
|
17
|
-
subject: leak.path,
|
|
18
|
-
details: { context: leak.context, pattern: leak.pattern, matchedText: leak.matchedText },
|
|
19
|
-
}));
|
|
20
|
-
return { status: findings.length > 0 ? 'fail' : 'pass', findings };
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
export const DISCLOSURE_CHECKS = [leakCheck];
|
|
24
|
-
//# sourceMappingURL=disclosure-checks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure-checks.js","sourceRoot":"","sources":["../../../src/core/checks/disclosure-checks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,yKAAyK;AACzK,MAAM,CAAC,MAAM,SAAS,GAAG,WAAW,CAAC;IACnC,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,iFAAiF;IACxF,QAAQ,EAAE,aAAa;IACvB,UAAU,EAAE,mBAAmB;IAC/B,MAAM,EAAE,CAAC,OAAO,CAAC;IACjB,KAAK,CAAC,GAAG,CAAC,GAAG;QACX,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAc,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC/C,IAAI,EAAE,iBAAiB;YACvB,QAAQ,EAAE,SAAS;YACnB,OAAO,EAAE,IAAI,IAAI,CAAC,IAAI,mCAAmC,IAAI,CAAC,OAAO,mCAAmC,IAAI,CAAC,WAAW,IAAI;YAC5H,OAAO,EAAE,IAAI,CAAC,IAAI;YAClB,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE;SACzF,CAAC,CAAC,CAAC;QACJ,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrE,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { StoreConfig } from '../../config/schema.js';
|
|
2
|
-
import type { Note } from '../notes/list.js';
|
|
3
|
-
export interface LeakFinding {
|
|
4
|
-
path: string;
|
|
5
|
-
context: string;
|
|
6
|
-
pattern: string;
|
|
7
|
-
matchedText: string;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* disclosure-policy spec (store-primitives-from-migration-audit D3): a leak
|
|
11
|
-
* is content that belongs to context X (per an operator-declared marker
|
|
12
|
-
* pattern) inside a note X cannot see, per the SAME context→visible-values
|
|
13
|
-
* mapping the visibility pre-filter and disclosure's internal-audience rung
|
|
14
|
-
* use — "X cannot see the note" is exactly `!canSee(config, X, resolved)`.
|
|
15
|
-
* Empty markers (the default) make this a no-op for every note.
|
|
16
|
-
*/
|
|
17
|
-
export declare function scanNoteForLeaks(config: StoreConfig, note: Note): LeakFinding[];
|
|
18
|
-
export declare function scanForLeaks(config: StoreConfig, notes: readonly Note[]): LeakFinding[];
|
|
19
|
-
//# sourceMappingURL=leak-scan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"leak-scan.d.ts","sourceRoot":"","sources":["../../../src/core/disclosure/leak-scan.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,WAAW,EAAE,CAgB/E;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,IAAI,EAAE,GAAG,WAAW,EAAE,CAEvF"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { canSee, resolveVisibility } from '../notes/visibility.js';
|
|
2
|
-
/**
|
|
3
|
-
* disclosure-policy spec (store-primitives-from-migration-audit D3): a leak
|
|
4
|
-
* is content that belongs to context X (per an operator-declared marker
|
|
5
|
-
* pattern) inside a note X cannot see, per the SAME context→visible-values
|
|
6
|
-
* mapping the visibility pre-filter and disclosure's internal-audience rung
|
|
7
|
-
* use — "X cannot see the note" is exactly `!canSee(config, X, resolved)`.
|
|
8
|
-
* Empty markers (the default) make this a no-op for every note.
|
|
9
|
-
*/
|
|
10
|
-
export function scanNoteForLeaks(config, note) {
|
|
11
|
-
const markers = config.disclosure.leak_markers;
|
|
12
|
-
if (Object.keys(markers).length === 0)
|
|
13
|
-
return [];
|
|
14
|
-
const resolved = resolveVisibility(config, note).value;
|
|
15
|
-
const findings = [];
|
|
16
|
-
for (const [context, patterns] of Object.entries(markers)) {
|
|
17
|
-
if (canSee(config, context, resolved))
|
|
18
|
-
continue;
|
|
19
|
-
for (const pattern of patterns) {
|
|
20
|
-
const match = new RegExp(pattern).exec(note.body);
|
|
21
|
-
if (match) {
|
|
22
|
-
findings.push({ path: note.path, context, pattern, matchedText: match[0] });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
return findings;
|
|
27
|
-
}
|
|
28
|
-
export function scanForLeaks(config, notes) {
|
|
29
|
-
return notes.flatMap((note) => scanNoteForLeaks(config, note));
|
|
30
|
-
}
|
|
31
|
-
//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,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { StoreConfig } from '../../config/schema.js';
|
|
2
|
-
import type { Note } from '../notes/list.js';
|
|
3
|
-
export type DisclosureVerdict = 'allow' | 'deny' | 'ask';
|
|
4
|
-
export type DisclosureRung = 'hard_wall' | 'explicit_tag' | 'internal_visibility' | 'external_default';
|
|
5
|
-
export interface DisclosureResult {
|
|
6
|
-
verdict: DisclosureVerdict;
|
|
7
|
-
rung: DisclosureRung;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* disclosure-policy spec: ordered walls-before-allows evaluation, stopping
|
|
11
|
-
* at the first rung that produces a verdict. Rung 3 (internal-audience-
|
|
12
|
-
* from-visibility) only applies when the requested audience is one the
|
|
13
|
-
* operator has declared internal — for any other (external) audience, rung
|
|
14
|
-
* 3 is skipped entirely and evaluation falls straight to rung 4's ASK, so an
|
|
15
|
-
* external verdict is never derived from visibility alone.
|
|
16
|
-
*/
|
|
17
|
-
export declare function evaluateDisclosure(config: StoreConfig, note: Note, audience: string): DisclosureResult;
|
|
18
|
-
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/core/disclosure/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG7C,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG,cAAc,GAAG,qBAAqB,GAAG,kBAAkB,CAAC;AAEvG,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,iBAAiB,CAAC;IAC3B,IAAI,EAAE,cAAc,CAAC;CACtB;AAoBD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,GAAG,gBAAgB,CAkBtG"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { canSee, resolveVisibility } from '../notes/visibility.js';
|
|
2
|
-
/**
|
|
3
|
-
* The frontmatter key a note uses to explicitly declare which audiences may
|
|
4
|
-
* see it disclosed (rung 2). Unlike the visibility field (context-store
|
|
5
|
-
* spec), nothing asks this key to be configurable, so it lives here as the
|
|
6
|
-
* one literal — same discipline as every other single-purpose constant in
|
|
7
|
-
* this codebase, just without a dedicated defaults.ts entry since no other
|
|
8
|
-
* module needs to reference it.
|
|
9
|
-
*/
|
|
10
|
-
const AUDIENCE_FIELD_KEY = 'audience';
|
|
11
|
-
function matchesWall(wall, note, audience) {
|
|
12
|
-
if (wall.audience !== '*' && wall.audience !== audience)
|
|
13
|
-
return false;
|
|
14
|
-
if (wall.except?.includes(audience))
|
|
15
|
-
return false;
|
|
16
|
-
if (!wall.note_path_prefix)
|
|
17
|
-
return true;
|
|
18
|
-
const prefix = wall.note_path_prefix.endsWith('/') ? wall.note_path_prefix : `${wall.note_path_prefix}/`;
|
|
19
|
-
return note.path === wall.note_path_prefix || note.path.startsWith(prefix);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* disclosure-policy spec: ordered walls-before-allows evaluation, stopping
|
|
23
|
-
* at the first rung that produces a verdict. Rung 3 (internal-audience-
|
|
24
|
-
* from-visibility) only applies when the requested audience is one the
|
|
25
|
-
* operator has declared internal — for any other (external) audience, rung
|
|
26
|
-
* 3 is skipped entirely and evaluation falls straight to rung 4's ASK, so an
|
|
27
|
-
* external verdict is never derived from visibility alone.
|
|
28
|
-
*/
|
|
29
|
-
export function evaluateDisclosure(config, note, audience) {
|
|
30
|
-
for (const wall of config.disclosure.hard_walls) {
|
|
31
|
-
if (matchesWall(wall, note, audience)) {
|
|
32
|
-
return { verdict: wall.verdict, rung: 'hard_wall' };
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
const tags = note.frontmatter?.[AUDIENCE_FIELD_KEY];
|
|
36
|
-
if (Array.isArray(tags) && tags.includes(audience)) {
|
|
37
|
-
return { verdict: 'allow', rung: 'explicit_tag' };
|
|
38
|
-
}
|
|
39
|
-
if (config.disclosure.internal_audiences.includes(audience)) {
|
|
40
|
-
const resolved = resolveVisibility(config, note);
|
|
41
|
-
return { verdict: canSee(config, audience, resolved.value) ? 'allow' : 'deny', rung: 'internal_visibility' };
|
|
42
|
-
}
|
|
43
|
-
return { verdict: 'ask', rung: 'external_default' };
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=model.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/core/disclosure/model.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAWnE;;;;;;;GAOG;AACH,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAEtC,SAAS,WAAW,CAAC,IAAoB,EAAE,IAAU,EAAE,QAAgB;IACrE,IAAI,IAAI,CAAC,QAAQ,KAAK,GAAG,IAAI,IAAI,CAAC,QAAQ,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtE,IAAI,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,KAAK,CAAC;IAClD,IAAI,CAAC,IAAI,CAAC,gBAAgB;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,GAAG,CAAC;IACzG,OAAO,IAAI,CAAC,IAAI,KAAK,I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**
|
|
4
|
-
* context-visibility spec: "excluded... before that operation ranks,
|
|
5
|
-
* traverses, or otherwise processes results" — filtering the persisted
|
|
6
|
-
* graph down to only visible nodes BEFORE calling neighbors/shortestPath/
|
|
7
|
-
* hubs/orphans means an excluded note contributes no edges to any of them,
|
|
8
|
-
* not merely a post-hoc omission from the final list. A node with no
|
|
9
|
-
* corresponding current note (a stale graph entry) is excluded rather than
|
|
10
|
-
* included — visibility can't be resolved for it, so it fails closed.
|
|
11
|
-
*/
|
|
12
|
-
export declare function filterGraphByAudience(store: Store, graph: GraphBuildResult, audience: string): Promise<GraphBuildResult>;
|
|
13
|
-
//# sourceMappingURL=visibility-filter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visibility-filter.d.ts","sourceRoot":"","sources":["../../../src/core/graph/visibility-filter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CACzC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,gBAAgB,EACvB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,gBAAgB,CAAC,CAa3B"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { listNotes } from '../notes/list.js';
|
|
2
|
-
import { canSee, resolveVisibility } from '../notes/visibility.js';
|
|
3
|
-
import { subgraph } from './query.js';
|
|
4
|
-
/**
|
|
5
|
-
* context-visibility spec: "excluded... before that operation ranks,
|
|
6
|
-
* traverses, or otherwise processes results" — filtering the persisted
|
|
7
|
-
* graph down to only visible nodes BEFORE calling neighbors/shortestPath/
|
|
8
|
-
* hubs/orphans means an excluded note contributes no edges to any of them,
|
|
9
|
-
* not merely a post-hoc omission from the final list. A node with no
|
|
10
|
-
* corresponding current note (a stale graph entry) is excluded rather than
|
|
11
|
-
* included — visibility can't be resolved for it, so it fails closed.
|
|
12
|
-
*/
|
|
13
|
-
export async function filterGraphByAudience(store, graph, audience) {
|
|
14
|
-
const notes = await listNotes(store.root, store.config);
|
|
15
|
-
const byPath = new Map(notes.map((note) => [note.path, note]));
|
|
16
|
-
const visibleIds = graph.nodes
|
|
17
|
-
.filter((node) => {
|
|
18
|
-
const note = byPath.get(node.path);
|
|
19
|
-
if (!note)
|
|
20
|
-
return false;
|
|
21
|
-
return canSee(store.config, audience, resolveVisibility(store.config, note).value);
|
|
22
|
-
})
|
|
23
|
-
.map((node) => node.id);
|
|
24
|
-
return subgraph(graph, visibleIds);
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=visibility-filter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visibility-filter.js","sourceRoot":"","sources":["../../../src/core/graph/visibility-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,KAAY,EACZ,KAAuB,EACvB,QAAgB;IAEhB,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAE/D,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK;SAC3B,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAC;QACxB,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC;IACrF,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAE1B,OAAO,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;AACrC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename-visibility-field.d.ts","sourceRoot":"","sources":["../../../src/core/migrations/rename-visibility-field.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AAsB5D,eAAO,MAAM,8BAA8B,EAAE,SAuC5C,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { DEFAULT_VISIBILITY_FIELD_KEY, SCHEMA_V1_VISIBILITY_FIELD_KEY } from '../../config/defaults.js';
|
|
3
|
-
import { readConfig } from '../../config/load.js';
|
|
4
|
-
import { renderStoreConfig } from '../../config/render.js';
|
|
5
|
-
import { writeFileAtomic } from '../fs/atomic.js';
|
|
6
|
-
import { listNotes } from '../notes/list.js';
|
|
7
|
-
import { parseNote } from '../notes/parse.js';
|
|
8
|
-
import { renderNoteText } from '../notes/render.js';
|
|
9
|
-
const OLD_KEY = SCHEMA_V1_VISIBILITY_FIELD_KEY;
|
|
10
|
-
const NEW_KEY = DEFAULT_VISIBILITY_FIELD_KEY;
|
|
11
|
-
/**
|
|
12
|
-
* store-lifecycle spec (task 9.2): the concrete migration proving the
|
|
13
|
-
* naming-inoculation design holds. The key to search for is the FIXED
|
|
14
|
-
* historical literal (OLD_KEY), never `store.config.fields.visibility` —
|
|
15
|
-
* that field is exactly what apply()'s own last step changes, so deriving
|
|
16
|
-
* "what to look for" from it would make a resumed run, on a store whose
|
|
17
|
-
* config was already bumped but whose notes weren't all done yet,
|
|
18
|
-
* incorrectly treat the (already-correct) new key as something to rename
|
|
19
|
-
* away from. A per-note check is "done" precisely when OLD_KEY is gone
|
|
20
|
-
* from its frontmatter — true whether it was never present or already
|
|
21
|
-
* renamed, which is what makes a re-run naturally skip completed work.
|
|
22
|
-
*/
|
|
23
|
-
async function pendingNoteRenames(store) {
|
|
24
|
-
const notes = await listNotes(store.root, store.config);
|
|
25
|
-
return notes.filter((note) => note.frontmatter?.[OLD_KEY] !== undefined).map((note) => note.path);
|
|
26
|
-
}
|
|
27
|
-
export const renameVisibilityFieldMigration = {
|
|
28
|
-
id: '0002-rename-visibility-field-to-lens',
|
|
29
|
-
fromVersion: 1,
|
|
30
|
-
toVersion: 2,
|
|
31
|
-
description: `Rename the visibility frontmatter field from "${OLD_KEY}" to "${NEW_KEY}", on every note and in contexture.yaml.`,
|
|
32
|
-
async plan(store) {
|
|
33
|
-
const deltas = (await pendingNoteRenames(store)).map((notePath) => ({
|
|
34
|
-
path: notePath,
|
|
35
|
-
description: `rename frontmatter field "${OLD_KEY}" to "${NEW_KEY}"`,
|
|
36
|
-
}));
|
|
37
|
-
if (store.config.fields.visibility !== NEW_KEY || store.config.schema_version < 2) {
|
|
38
|
-
deltas.push({ path: 'contexture.yaml', description: `set fields.visibility to "${NEW_KEY}" and schema_version to 2` });
|
|
39
|
-
}
|
|
40
|
-
return deltas;
|
|
41
|
-
},
|
|
42
|
-
async apply(store) {
|
|
43
|
-
const applied = [];
|
|
44
|
-
for (const notePath of await pendingNoteRenames(store)) {
|
|
45
|
-
const absolutePath = path.join(store.root, notePath);
|
|
46
|
-
const note = await parseNote(absolutePath, notePath);
|
|
47
|
-
const { [OLD_KEY]: value, ...rest } = note.frontmatter ?? {};
|
|
48
|
-
const frontmatter = { ...rest, [NEW_KEY]: value };
|
|
49
|
-
await writeFileAtomic(absolutePath, renderNoteText(frontmatter, note.body));
|
|
50
|
-
applied.push({ path: notePath, description: `renamed frontmatter field "${OLD_KEY}" to "${NEW_KEY}"` });
|
|
51
|
-
}
|
|
52
|
-
const configPath = path.join(store.root, 'contexture.yaml');
|
|
53
|
-
const currentConfig = await readConfig(store.root);
|
|
54
|
-
if (currentConfig.fields.visibility !== NEW_KEY || currentConfig.schema_version < 2) {
|
|
55
|
-
const nextConfig = { ...currentConfig, fields: { ...currentConfig.fields, visibility: NEW_KEY }, schema_version: 2 };
|
|
56
|
-
await writeFileAtomic(configPath, renderStoreConfig(nextConfig));
|
|
57
|
-
applied.push({ path: 'contexture.yaml', description: `set fields.visibility to "${NEW_KEY}" and schema_version to 2` });
|
|
58
|
-
}
|
|
59
|
-
return applied;
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
//# sourceMappingURL=rename-visibility-field.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rename-visibility-field.js","sourceRoot":"","sources":["../../../src/core/migrations/rename-visibility-field.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIpD,MAAM,OAAO,GAAG,8BAA8B,CAAC;AAC/C,MAAM,OAAO,GAAG,4BAA4B,CAAC;AAE7C;;;;;;;;;;;GAWG;AACH,KAAK,UAAU,kBAAkB,CAAC,KAAY;IAC5C,MAAM,KAAK,G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
1
|
-
/**
|
|
2
|
-
* store-lifecycle/context-visibility: a note relying on the fail-closed
|
|
3
|
-
* default is a health OBSERVATION (lint), not a doctor-failing invariant —
|
|
4
|
-
* doctor's own fail-closed-visibility invariant (wired in Phase 5, below)
|
|
5
|
-
* is a different, stricter check. `severity: 'observation'` is what keeps
|
|
6
|
-
* this out of doctor's exit code by construction, via the same registry
|
|
7
|
-
* lint reads from in Phase 7.
|
|
8
|
-
*/
|
|
9
|
-
export declare const failClosedVisibilityCheck: import("../checks/types.js").CheckDefinition;
|
|
10
|
-
/**
|
|
11
|
-
* context-visibility spec (task 5.2): the same underlying condition as the
|
|
12
|
-
* lint-facing observation above, registered a second time as its own
|
|
13
|
-
* invariant so `doctor` can fail a run on it. Each check id carries exactly
|
|
14
|
-
* one severity, so the two never double-count a single run's pass/fail
|
|
15
|
-
* totals against each other (task 9.4) even though both watch the same
|
|
16
|
-
* condition for two different audiences (an operator skimming lint output,
|
|
17
|
-
* versus a gate that must block).
|
|
18
|
-
*/
|
|
19
|
-
export declare const failClosedVisibilityInvariantCheck: import("../checks/types.js").CheckDefinition;
|
|
20
|
-
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../src/core/notes/checks.ts"],"names":[],"mappings":"AAsBA;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,8CAUpC,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,8CAU7C,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { defineCheck } from '../checks/types.js';
|
|
2
|
-
import { resolveVisibility } from './visibility.js';
|
|
3
|
-
async function failClosedFindings(ctx) {
|
|
4
|
-
const notes = await ctx.notes();
|
|
5
|
-
const findings = [];
|
|
6
|
-
for (const note of notes) {
|
|
7
|
-
const resolution = resolveVisibility(ctx.config, note);
|
|
8
|
-
if (resolution.reason === 'fail-closed default') {
|
|
9
|
-
findings.push({
|
|
10
|
-
code: 'visibility.fail_closed_default',
|
|
11
|
-
severity: 'info',
|
|
12
|
-
message: `"${note.path}" has no explicit or directory-derived visibility; relying on the fail-closed default.`,
|
|
13
|
-
subject: note.path,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return findings;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* store-lifecycle/context-visibility: a note relying on the fail-closed
|
|
21
|
-
* default is a health OBSERVATION (lint), not a doctor-failing invariant —
|
|
22
|
-
* doctor's own fail-closed-visibility invariant (wired in Phase 5, below)
|
|
23
|
-
* is a different, stricter check. `severity: 'observation'` is what keeps
|
|
24
|
-
* this out of doctor's exit code by construction, via the same registry
|
|
25
|
-
* lint reads from in Phase 7.
|
|
26
|
-
*/
|
|
27
|
-
export const failClosedVisibilityCheck = defineCheck({
|
|
28
|
-
id: 'visibility.fail_closed_default',
|
|
29
|
-
title: 'Notes relying on the fail-closed default visibility',
|
|
30
|
-
severity: 'observation',
|
|
31
|
-
capability: 'context-visibility',
|
|
32
|
-
scopes: ['store'],
|
|
33
|
-
async run(ctx) {
|
|
34
|
-
const findings = await failClosedFindings(ctx);
|
|
35
|
-
return { status: findings.length > 0 ? 'fail' : 'pass', findings };
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
/**
|
|
39
|
-
* context-visibility spec (task 5.2): the same underlying condition as the
|
|
40
|
-
* lint-facing observation above, registered a second time as its own
|
|
41
|
-
* invariant so `doctor` can fail a run on it. Each check id carries exactly
|
|
42
|
-
* one severity, so the two never double-count a single run's pass/fail
|
|
43
|
-
* totals against each other (task 9.4) even though both watch the same
|
|
44
|
-
* condition for two different audiences (an operator skimming lint output,
|
|
45
|
-
* versus a gate that must block).
|
|
46
|
-
*/
|
|
47
|
-
export const failClosedVisibilityInvariantCheck = defineCheck({
|
|
48
|
-
id: 'visibility.fail_closed_default_invariant',
|
|
49
|
-
title: 'Every note has a resolvable visibility value',
|
|
50
|
-
severity: 'invariant',
|
|
51
|
-
capability: 'context-visibility',
|
|
52
|
-
scopes: ['store'],
|
|
53
|
-
async run(ctx) {
|
|
54
|
-
const findings = await failClosedFindings(ctx);
|
|
55
|
-
return { status: findings.length > 0 ? 'fail' : 'pass', findings };
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=checks.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../src/core/notes/checks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,KAAK,UAAU,kBAAkB,CAAC,GAAiB;IACjD,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,KAAK,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,UAAU,GAAG,iBAAiB,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QACvD,IAAI,UAAU,CAAC,MAAM,KAAK,qBAAqB,EAAE,CAAC;YAChD,QAAQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,gCAAgC;gBACtC,QAAQ,EAAE,MAAM;gBAChB,OAAO,EAAE,IAAI,IAAI,CAAC,IAAI,wFAAwF;gBAC9G,OAAO,EAAE,IAAI,CAAC,IAAI;aACnB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,WAAW,CAAC;IACnD,EAAE,EAAE,gCAAgC;IACpC,KAAK,EAAE,qDAAqD;IAC5D,QAAQ,EAAE,aAAa;IACvB,UAAU,EAAE,oBAAoB;IAChC,MAAM,EAAE,CAAC,OAAO,CAAC;IACjB,KAAK,CAAC,GAAG,CAAC,GAAG;QACX,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrE,CAAC;CACF,CAAC,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,WAAW,CAAC;IAC5D,EAAE,EAAE,0CAA0C;IAC9C,KAAK,EAAE,8CAA8C;IACrD,QAAQ,EAAE,WAAW;IACrB,UAAU,EAAE,oBAAoB;IAChC,MAAM,EAAE,CAAC,OAAO,CAAC;IACjB,KAAK,CAAC,GAAG,CAAC,GAAG;QACX,MAAM,QAAQ,GAAG,MAAM,kBAAkB,CAAC,GAAG,CAAC,CAAC;QAC/C,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACrE,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { StoreConfig } from '../../config/schema.js';
|
|
2
|
-
import type { Note } from './list.js';
|
|
3
|
-
/**
|
|
4
|
-
* context-visibility spec: resolution order is explicit → directory default
|
|
5
|
-
* → the configured fail-closed default, and every resolution reports WHICH
|
|
6
|
-
* rung produced it — not just the resolved value — so a note relying on the
|
|
7
|
-
* fail-closed default is distinguishable from one genuinely classified.
|
|
8
|
-
*/
|
|
9
|
-
export type VisibilityReason = 'explicit' | 'directory default' | 'fail-closed default';
|
|
10
|
-
export interface VisibilityResolution {
|
|
11
|
-
value: string;
|
|
12
|
-
reason: VisibilityReason;
|
|
13
|
-
}
|
|
14
|
-
export declare function resolveVisibility(config: StoreConfig, note: Note): VisibilityResolution;
|
|
15
|
-
/**
|
|
16
|
-
* context-visibility spec (visibility-contexts-and-wall-verdicts): the set
|
|
17
|
-
* of visibility VALUES a requesting context can see — the one shared
|
|
18
|
-
* primitive every filtered consumer (graph pre-filter, disclosure rung 3)
|
|
19
|
-
* calls instead of raw equality. Identity default: an unconfigured context
|
|
20
|
-
* sees exactly its own value, so unconfigured stores behave exactly as
|
|
21
|
-
* before the mapping existed, and unknown contexts fail closed to it.
|
|
22
|
-
*/
|
|
23
|
-
export declare function visibleValuesFor(config: StoreConfig, context: string): readonly string[];
|
|
24
|
-
/** Whether `context` can see a note whose resolved visibility is `value`. */
|
|
25
|
-
export declare function canSee(config: StoreConfig, context: string, value: string): boolean;
|
|
26
|
-
//# sourceMappingURL=visibility.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"visibility.d.ts","sourceRoot":"","sources":["../../../src/core/notes/visibility.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,mBAAmB,GAAG,qBAAqB,CAAC;AAExF,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,oBAAoB,CAavF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAExF;AAED,6EAA6E;AAC7E,wBAAgB,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnF"}
|