@saydone/dab 0.0.0-stage → 0.1.2
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/AGENTS.md +62 -0
- package/CHANGELOG.md +52 -0
- package/CHANGELOG.zh.md +52 -0
- package/LICENSE +21 -0
- package/README.i18n.yaml +55 -0
- package/README.md +157 -2
- package/README.zh.md +158 -0
- package/dist/adapter/claude-code/adapter.d.ts +10 -0
- package/dist/adapter/claude-code/adapter.js +226 -0
- package/dist/adapter/claude-code/adapter.js.map +1 -0
- package/dist/adapter/claude-code/adoption.d.ts +58 -0
- package/dist/adapter/claude-code/adoption.js +749 -0
- package/dist/adapter/claude-code/adoption.js.map +1 -0
- package/dist/adapter/claude-code/hooks.d.ts +10 -0
- package/dist/adapter/claude-code/hooks.js +58 -0
- package/dist/adapter/claude-code/hooks.js.map +1 -0
- package/dist/adapter/claude-code/instructions.d.ts +26 -0
- package/dist/adapter/claude-code/instructions.js +235 -0
- package/dist/adapter/claude-code/instructions.js.map +1 -0
- package/dist/adapter/claude-code/options.d.ts +12 -0
- package/dist/adapter/claude-code/options.js +27 -0
- package/dist/adapter/claude-code/options.js.map +1 -0
- package/dist/adapter/claude-code/policy-compile.d.ts +30 -0
- package/dist/adapter/claude-code/policy-compile.js +293 -0
- package/dist/adapter/claude-code/policy-compile.js.map +1 -0
- package/dist/adapter/claude-code/projection.d.ts +36 -0
- package/dist/adapter/claude-code/projection.js +272 -0
- package/dist/adapter/claude-code/projection.js.map +1 -0
- package/dist/adapter/claude-code/settings-plan.d.ts +12 -0
- package/dist/adapter/claude-code/settings-plan.js +64 -0
- package/dist/adapter/claude-code/settings-plan.js.map +1 -0
- package/dist/adapter/claude-code/settings.d.ts +21 -0
- package/dist/adapter/claude-code/settings.js +58 -0
- package/dist/adapter/claude-code/settings.js.map +1 -0
- package/dist/adapter/claude-code/version.d.ts +8 -0
- package/dist/adapter/claude-code/version.js +32 -0
- package/dist/adapter/claude-code/version.js.map +1 -0
- package/dist/adapter/registry.d.ts +3 -0
- package/dist/adapter/registry.js +8 -0
- package/dist/adapter/registry.js.map +1 -0
- package/dist/adapter/types.d.ts +70 -0
- package/dist/adapter/types.js +2 -0
- package/dist/adapter/types.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +260 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/detect.d.ts +44 -0
- package/dist/commands/detect.js +543 -0
- package/dist/commands/detect.js.map +1 -0
- package/dist/commands/init.d.ts +48 -0
- package/dist/commands/init.js +727 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/normalize.d.ts +106 -0
- package/dist/commands/normalize.js +715 -0
- package/dist/commands/normalize.js.map +1 -0
- package/dist/commands/policy-explain.d.ts +47 -0
- package/dist/commands/policy-explain.js +283 -0
- package/dist/commands/policy-explain.js.map +1 -0
- package/dist/core/command.d.ts +13 -0
- package/dist/core/command.js +68 -0
- package/dist/core/command.js.map +1 -0
- package/dist/core/compare.d.ts +7 -0
- package/dist/core/compare.js +16 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.js +65 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/errors.d.ts +25 -0
- package/dist/core/errors.js +45 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/exit-codes.d.ts +8 -0
- package/dist/core/exit-codes.js +8 -0
- package/dist/core/exit-codes.js.map +1 -0
- package/dist/core/fs-atomic.d.ts +13 -0
- package/dist/core/fs-atomic.js +113 -0
- package/dist/core/fs-atomic.js.map +1 -0
- package/dist/core/gitignore.d.ts +6 -0
- package/dist/core/gitignore.js +54 -0
- package/dist/core/gitignore.js.map +1 -0
- package/dist/core/hash.d.ts +1 -0
- package/dist/core/hash.js +5 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/json.d.ts +3 -0
- package/dist/core/json.js +21 -0
- package/dist/core/json.js.map +1 -0
- package/dist/core/markdown-links.d.ts +5 -0
- package/dist/core/markdown-links.js +37 -0
- package/dist/core/markdown-links.js.map +1 -0
- package/dist/core/paths.d.ts +12 -0
- package/dist/core/paths.js +152 -0
- package/dist/core/paths.js.map +1 -0
- package/dist/core/platform.d.ts +1 -0
- package/dist/core/platform.js +7 -0
- package/dist/core/platform.js.map +1 -0
- package/dist/core/practice-paths.d.ts +73 -0
- package/dist/core/practice-paths.js +310 -0
- package/dist/core/practice-paths.js.map +1 -0
- package/dist/core/security.d.ts +2 -0
- package/dist/core/security.js +101 -0
- package/dist/core/security.js.map +1 -0
- package/dist/core/semver.d.ts +9 -0
- package/dist/core/semver.js +32 -0
- package/dist/core/semver.js.map +1 -0
- package/dist/core/skill-marker.d.ts +28 -0
- package/dist/core/skill-marker.js +57 -0
- package/dist/core/skill-marker.js.map +1 -0
- package/dist/core/version-check.d.ts +10 -0
- package/dist/core/version-check.js +28 -0
- package/dist/core/version-check.js.map +1 -0
- package/dist/core/version-compare.d.ts +8 -0
- package/dist/core/version-compare.js +23 -0
- package/dist/core/version-compare.js.map +1 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.js +13 -0
- package/dist/core/version.js.map +1 -0
- package/dist/core/yaml.d.ts +4 -0
- package/dist/core/yaml.js +24 -0
- package/dist/core/yaml.js.map +1 -0
- package/dist/detect/ancestor-claude-md.d.ts +1 -0
- package/dist/detect/ancestor-claude-md.js +33 -0
- package/dist/detect/ancestor-claude-md.js.map +1 -0
- package/dist/detect/checklist.d.ts +42 -0
- package/dist/detect/checklist.js +137 -0
- package/dist/detect/checklist.js.map +1 -0
- package/dist/detect/checks.d.ts +13 -0
- package/dist/detect/checks.js +537 -0
- package/dist/detect/checks.js.map +1 -0
- package/dist/detect/practice.d.ts +43 -0
- package/dist/detect/practice.js +782 -0
- package/dist/detect/practice.js.map +1 -0
- package/dist/detect/preflight.d.ts +21 -0
- package/dist/detect/preflight.js +408 -0
- package/dist/detect/preflight.js.map +1 -0
- package/dist/docs/budgets.d.ts +2 -0
- package/dist/docs/budgets.js +57 -0
- package/dist/docs/budgets.js.map +1 -0
- package/dist/docs/cli.d.ts +7 -0
- package/dist/docs/cli.js +102 -0
- package/dist/docs/cli.js.map +1 -0
- package/dist/docs/config.d.ts +8 -0
- package/dist/docs/config.js +82 -0
- package/dist/docs/config.js.map +1 -0
- package/dist/docs/doc-sync.d.ts +10 -0
- package/dist/docs/doc-sync.js +33 -0
- package/dist/docs/doc-sync.js.map +1 -0
- package/dist/docs/files.d.ts +1 -0
- package/dist/docs/files.js +42 -0
- package/dist/docs/files.js.map +1 -0
- package/dist/docs/links.d.ts +3 -0
- package/dist/docs/links.js +90 -0
- package/dist/docs/links.js.map +1 -0
- package/dist/docs/markdown.d.ts +55 -0
- package/dist/docs/markdown.js +227 -0
- package/dist/docs/markdown.js.map +1 -0
- package/dist/docs/notes.d.ts +2 -0
- package/dist/docs/notes.js +175 -0
- package/dist/docs/notes.js.map +1 -0
- package/dist/docs/pairing.d.ts +45 -0
- package/dist/docs/pairing.js +472 -0
- package/dist/docs/pairing.js.map +1 -0
- package/dist/docs/wrap.d.ts +2 -0
- package/dist/docs/wrap.js +98 -0
- package/dist/docs/wrap.js.map +1 -0
- package/dist/init/adoption.d.ts +138 -0
- package/dist/init/adoption.js +747 -0
- package/dist/init/adoption.js.map +1 -0
- package/dist/init/ai-proposal.d.ts +15 -0
- package/dist/init/ai-proposal.js +164 -0
- package/dist/init/ai-proposal.js.map +1 -0
- package/dist/init/docs-language.d.ts +12 -0
- package/dist/init/docs-language.js +110 -0
- package/dist/init/docs-language.js.map +1 -0
- package/dist/init/managed-skills.d.ts +81 -0
- package/dist/init/managed-skills.js +407 -0
- package/dist/init/managed-skills.js.map +1 -0
- package/dist/init/minimal-source.d.ts +14 -0
- package/dist/init/minimal-source.js +42 -0
- package/dist/init/minimal-source.js.map +1 -0
- package/dist/init/practice-authoring.d.ts +5 -0
- package/dist/init/practice-authoring.js +36 -0
- package/dist/init/practice-authoring.js.map +1 -0
- package/dist/init/practice-docs.d.ts +13 -0
- package/dist/init/practice-docs.js +278 -0
- package/dist/init/practice-docs.js.map +1 -0
- package/dist/init/practice.d.ts +78 -0
- package/dist/init/practice.js +528 -0
- package/dist/init/practice.js.map +1 -0
- package/dist/init/scanner.d.ts +22 -0
- package/dist/init/scanner.js +190 -0
- package/dist/init/scanner.js.map +1 -0
- package/dist/init/skill-templates.d.ts +7 -0
- package/dist/init/skill-templates.js +25 -0
- package/dist/init/skill-templates.js.map +1 -0
- package/dist/init/templates.d.ts +53 -0
- package/dist/init/templates.js +254 -0
- package/dist/init/templates.js.map +1 -0
- package/dist/model/agents-md.d.ts +6 -0
- package/dist/model/agents-md.js +41 -0
- package/dist/model/agents-md.js.map +1 -0
- package/dist/model/agents.d.ts +12 -0
- package/dist/model/agents.js +346 -0
- package/dist/model/agents.js.map +1 -0
- package/dist/model/diagnostics-codes.d.ts +34 -0
- package/dist/model/diagnostics-codes.js +35 -0
- package/dist/model/diagnostics-codes.js.map +1 -0
- package/dist/model/facts.d.ts +10 -0
- package/dist/model/facts.js +36 -0
- package/dist/model/facts.js.map +1 -0
- package/dist/model/frontmatter.d.ts +17 -0
- package/dist/model/frontmatter.js +97 -0
- package/dist/model/frontmatter.js.map +1 -0
- package/dist/model/hooks.d.ts +2 -0
- package/dist/model/hooks.js +175 -0
- package/dist/model/hooks.js.map +1 -0
- package/dist/model/memory.d.ts +3 -0
- package/dist/model/memory.js +165 -0
- package/dist/model/memory.js.map +1 -0
- package/dist/model/policy.d.ts +8 -0
- package/dist/model/policy.js +46 -0
- package/dist/model/policy.js.map +1 -0
- package/dist/model/project-manifest.d.ts +26 -0
- package/dist/model/project-manifest.js +210 -0
- package/dist/model/project-manifest.js.map +1 -0
- package/dist/model/rules.d.ts +2 -0
- package/dist/model/rules.js +98 -0
- package/dist/model/rules.js.map +1 -0
- package/dist/model/schemas.d.ts +379 -0
- package/dist/model/schemas.js +310 -0
- package/dist/model/schemas.js.map +1 -0
- package/dist/model/scope.d.ts +29 -0
- package/dist/model/scope.js +204 -0
- package/dist/model/scope.js.map +1 -0
- package/dist/model/skills.d.ts +12 -0
- package/dist/model/skills.js +181 -0
- package/dist/model/skills.js.map +1 -0
- package/dist/model/types.d.ts +87 -0
- package/dist/model/types.js +2 -0
- package/dist/model/types.js.map +1 -0
- package/package.json +60 -4
- package/skills/dab-architecture-writing/SKILL.md +58 -0
- package/skills/dab-decision-notes/SKILL.md +57 -0
- package/skills/dab-doc-writing/SKILL.md +58 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { Diagnostic } from '../core/diagnostics.ts';
|
|
2
|
+
import { type ClaudeAdoptionEntry, type ClaudeAdoptionPlan } from '../adapter/claude-code/adoption.ts';
|
|
3
|
+
import { type ManagedSkillApplyResult, type ManagedSkillPlan } from './managed-skills.ts';
|
|
4
|
+
import { type Scope, type SourceRoot } from '../model/scope.ts';
|
|
5
|
+
import type { ProjectManifest, ProjectPaths } from '../model/types.ts';
|
|
6
|
+
import { type MinimalSourcePlan } from './minimal-source.ts';
|
|
7
|
+
import { type AuthoredScaffoldPlan } from './practice.ts';
|
|
8
|
+
export { minimalSourcePlan, type MinimalSourcePlan } from './minimal-source.ts';
|
|
9
|
+
export type AdoptionPhase = 'initialized' | 'partial' | 'uninitialized';
|
|
10
|
+
export interface AdoptionRoot {
|
|
11
|
+
scope: Scope;
|
|
12
|
+
root: string;
|
|
13
|
+
sourceRoot: string;
|
|
14
|
+
manifestPath: string;
|
|
15
|
+
instructionsPath: string;
|
|
16
|
+
phase: AdoptionPhase;
|
|
17
|
+
manifestValid: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function resolveAdoptionRoot(input: {
|
|
20
|
+
cwd: string;
|
|
21
|
+
home: string;
|
|
22
|
+
}): Promise<AdoptionRoot>;
|
|
23
|
+
export declare function planSourceWrites(root: string, plan: MinimalSourcePlan): Promise<{
|
|
24
|
+
create: string[];
|
|
25
|
+
skip: string[];
|
|
26
|
+
}>;
|
|
27
|
+
export declare function writeSourceFiles(root: string, plan: MinimalSourcePlan): Promise<{
|
|
28
|
+
created: string[];
|
|
29
|
+
skipped: string[];
|
|
30
|
+
}>;
|
|
31
|
+
export interface NormalizeAdoptionPreparation {
|
|
32
|
+
sourceRoot: SourceRoot;
|
|
33
|
+
phase: AdoptionPhase;
|
|
34
|
+
manifest: ProjectManifest;
|
|
35
|
+
paths: ProjectPaths;
|
|
36
|
+
sourcePlan?: MinimalSourcePlan;
|
|
37
|
+
/** Practice docs/skills plan. In adoption mode its files are the source plan. */
|
|
38
|
+
practicePlan?: AuthoredScaffoldPlan;
|
|
39
|
+
claudePlan?: ClaudeAdoptionPlan;
|
|
40
|
+
/**
|
|
41
|
+
* Managed `dab-*` authoring-skill states. Computed for project scope after
|
|
42
|
+
* the practice preflight and before target planning.
|
|
43
|
+
*/
|
|
44
|
+
managedSkills?: ManagedSkillPlan;
|
|
45
|
+
/**
|
|
46
|
+
* Governed conflicts at non-practice `.agents` source parents. They block
|
|
47
|
+
* every write, so import planning is skipped and discovery never runs.
|
|
48
|
+
*/
|
|
49
|
+
sourceProblems?: Diagnostic[];
|
|
50
|
+
diagnostics: Diagnostic[];
|
|
51
|
+
}
|
|
52
|
+
export interface NormalizeAdoptionResult {
|
|
53
|
+
phase: AdoptionPhase;
|
|
54
|
+
sourcePlan?: MinimalSourcePlan;
|
|
55
|
+
sourceActions: string[];
|
|
56
|
+
/** Import actions applied on a real run or planned by a dry run. */
|
|
57
|
+
importActions: string[];
|
|
58
|
+
imports?: ClaudeAdoptionEntry[];
|
|
59
|
+
/** Import backups created on a real run or planned by a dry run. */
|
|
60
|
+
backups: string[];
|
|
61
|
+
diagnostics: Diagnostic[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Managed authoring-skill operations as reported to normalize. `created`,
|
|
65
|
+
* `updated`, `migrated` and `skipped` are the action categories applied (or
|
|
66
|
+
* planned by a dry run); the remaining lists carry the preserved states, and
|
|
67
|
+
* `actions` is the stable human/JSON action text.
|
|
68
|
+
*/
|
|
69
|
+
export interface ManagedSkillSummary {
|
|
70
|
+
actions: string[];
|
|
71
|
+
created: string[];
|
|
72
|
+
updated: string[];
|
|
73
|
+
migrated: string[];
|
|
74
|
+
skipped: string[];
|
|
75
|
+
/** Body hash no longer matches the marker; preserved. */
|
|
76
|
+
modified: string[];
|
|
77
|
+
/** Installed version is newer or uncomparable; preserved. */
|
|
78
|
+
newer: string[];
|
|
79
|
+
/** Legacy marker body differs from the template; preserved. */
|
|
80
|
+
legacy: string[];
|
|
81
|
+
/** No managed marker at all; preserved. */
|
|
82
|
+
unversioned: string[];
|
|
83
|
+
/** Marker names a different skill; preserved. */
|
|
84
|
+
markerMismatch: string[];
|
|
85
|
+
/** Targets changed between planning and applying; preserved. */
|
|
86
|
+
concurrent: string[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* The authoring pack owns missing skill files it planned itself, so the managed
|
|
90
|
+
* writer must not also create them. Legacy, stale and skipped states are
|
|
91
|
+
* untouched by the pack because an existing skill directory is user-owned.
|
|
92
|
+
*/
|
|
93
|
+
export declare function planManagedSkillWrites(plan: ManagedSkillPlan, practiceFiles: ReadonlySet<string>): ManagedSkillPlan;
|
|
94
|
+
/**
|
|
95
|
+
* Derive the normalize report from the writes plan. When the plan was applied,
|
|
96
|
+
* `applied` carries the revalidation outcome: a target that changed after
|
|
97
|
+
* planning moves from created/updated/migrated to the preserved `concurrent`
|
|
98
|
+
* list instead of claiming a write that did not happen. A dry run passes the
|
|
99
|
+
* same apply result (with no bytes written) so both modes agree.
|
|
100
|
+
*/
|
|
101
|
+
export declare function summarizeManagedSkills(plan: ManagedSkillPlan | undefined, applied?: ManagedSkillApplyResult): ManagedSkillSummary;
|
|
102
|
+
export interface PrepareAdoptionInput {
|
|
103
|
+
cwd: string;
|
|
104
|
+
home: string;
|
|
105
|
+
now?: Date;
|
|
106
|
+
/**
|
|
107
|
+
* Skip the Claude import plan entirely. `dab init` uses this so its existing
|
|
108
|
+
* behavior on an existing `.claude` tree is preserved: imports are
|
|
109
|
+
* normalize's job, not an init side effect.
|
|
110
|
+
*/
|
|
111
|
+
suppressImports?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Skip managed authoring-skill planning. `dab init` already installs missing
|
|
114
|
+
* skills and must never update an existing one, so its nested normalize run
|
|
115
|
+
* disables managed updates.
|
|
116
|
+
*/
|
|
117
|
+
suppressManagedSkills?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export declare function prepareNormalizeAdoption(input: PrepareAdoptionInput): Promise<NormalizeAdoptionPreparation>;
|
|
120
|
+
/**
|
|
121
|
+
* Applies the prepared adoption: minimal source writes first, then the Claude
|
|
122
|
+
* imports/backups/symlinks under the same backup root. Callers may pass a
|
|
123
|
+
* preparation with only one of the two plans to stage the writes around a
|
|
124
|
+
* read-only target preflight; a source containment failure skips the imports
|
|
125
|
+
* entirely so neither tree is touched.
|
|
126
|
+
*/
|
|
127
|
+
export declare function applyNormalizeAdoption(prep: NormalizeAdoptionPreparation, options: {
|
|
128
|
+
dryRun: boolean;
|
|
129
|
+
backupRoot: string;
|
|
130
|
+
}): Promise<{
|
|
131
|
+
actions: string[];
|
|
132
|
+
backups: string[];
|
|
133
|
+
diagnostics: Diagnostic[];
|
|
134
|
+
created: string[];
|
|
135
|
+
skipped: string[];
|
|
136
|
+
/** Absent when managed skills were not planned (global or init nested run). */
|
|
137
|
+
managed?: ManagedSkillSummary;
|
|
138
|
+
}>;
|