@thejoseki/clawform 2.3.0 → 2.3.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/README.md +141 -120
- package/bin/clawform.js +161 -151
- package/package.json +65 -65
- package/src/aws/catalog.js +116 -116
- package/src/aws/changeset.js +231 -231
- package/src/aws/drift.js +59 -59
- package/src/aws/exports.js +213 -213
- package/src/aws/inventory.js +156 -156
- package/src/commands/activate.js +34 -2
- package/src/commands/ci-init.js +393 -212
- package/src/commands/cost-report.js +163 -163
- package/src/commands/deactivate.js +9 -2
- package/src/commands/deploy.js +413 -413
- package/src/commands/diff.js +39 -39
- package/src/commands/drift.js +35 -35
- package/src/commands/init-plugin.js +6 -6
- package/src/commands/init.js +360 -360
- package/src/commands/rollback.js +126 -126
- package/src/commands/status.js +147 -147
- package/src/commands/sync.js +50 -50
- package/src/commands/update.js +24 -0
- package/src/commands/validate.js +349 -349
- package/src/hooks/block-dangerous.js +62 -62
- package/src/hooks/cfn-lint-after-edit-eval.js +30 -30
- package/src/hooks/cfn-lint-after-edit.js +81 -81
- package/src/hooks/check-catalog-fresh-eval.js +63 -63
- package/src/hooks/check-catalog-fresh.js +33 -33
- package/src/hooks/session-context-eval.js +81 -81
- package/src/hooks/session-context.js +41 -41
- package/src/hooks/subagent-context-eval.js +44 -44
- package/src/hooks/subagent-context.js +48 -48
- package/src/lib/audit-synthesis.js +24 -24
- package/src/lib/aws-client.js +15 -15
- package/src/lib/cfn-yaml.js +92 -92
- package/src/lib/config.js +76 -76
- package/src/lib/constants.js +85 -85
- package/src/lib/defaults.js +16 -16
- package/src/lib/install-workflow.js +28 -28
- package/src/lib/kit-source.js +43 -5
- package/src/lib/license-client.js +84 -84
- package/src/lib/license-config.js +162 -162
- package/src/lib/license-store.js +43 -8
- package/src/lib/license.js +15 -2
- package/src/lib/lint-overrides.js +226 -226
- package/src/lib/logger.js +16 -16
- package/src/lib/project-config.js +145 -145
- package/src/lib/providers/polar.js +215 -215
- package/src/lib/session-state.js +91 -91
package/src/commands/sync.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { logger } from '../lib/logger.js';
|
|
5
|
-
import { loadConfig } from '../lib/config.js';
|
|
6
|
-
import { loadProjectConfig, resolveProjectDir } from '../lib/project-config.js';
|
|
7
|
-
import { cfnClient } from '../lib/aws-client.js';
|
|
8
|
-
import { fetchExports, groupExports, renderCatalog } from '../aws/catalog.js';
|
|
9
|
-
import { fetchStacks, classifyStacks, renderInventory } from '../aws/inventory.js';
|
|
10
|
-
import { ensureWorkflowInstalled } from '../lib/install-workflow.js';
|
|
11
|
-
import { CATALOG_DIR_REL } from '../lib/constants.js';
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { logger } from '../lib/logger.js';
|
|
5
|
+
import { loadConfig } from '../lib/config.js';
|
|
6
|
+
import { loadProjectConfig, resolveProjectDir } from '../lib/project-config.js';
|
|
7
|
+
import { cfnClient } from '../lib/aws-client.js';
|
|
8
|
+
import { fetchExports, groupExports, renderCatalog } from '../aws/catalog.js';
|
|
9
|
+
import { fetchStacks, classifyStacks, renderInventory } from '../aws/inventory.js';
|
|
10
|
+
import { ensureWorkflowInstalled } from '../lib/install-workflow.js';
|
|
11
|
+
import { CATALOG_DIR_REL } from '../lib/constants.js';
|
|
12
12
|
import { assertLicensed } from '../lib/license.js';
|
|
13
13
|
import { resolveClient as resolveLicenseClient } from '../lib/license-client.js';
|
|
14
|
-
|
|
15
|
-
const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
const REPO_ROOT = join(dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
16
|
+
|
|
17
17
|
export default async function sync(opts = {}) {
|
|
18
|
-
await assertLicensed({ command: 'sync', client: resolveLicenseClient() });
|
|
19
|
-
const cfg = loadConfig(opts);
|
|
20
|
-
logger.step('clawform sync — refresh catalog + inventory');
|
|
21
|
-
logger.info(`Profile: ${cfg.AWS_PROFILE} Region: ${cfg.AWS_REGION}`);
|
|
22
|
-
const client = cfnClient(opts);
|
|
23
|
-
|
|
24
|
-
const meta = {
|
|
25
|
-
generatedAt: new Date().toISOString(),
|
|
26
|
-
account: cfg.ACCOUNT_DEV || '(unknown)',
|
|
27
|
-
region: cfg.AWS_REGION,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
logger.info('Fetching exports + stacks in parallel…');
|
|
31
|
-
const [exports, stacks] = await Promise.all([fetchExports(client), fetchStacks(client)]);
|
|
32
|
-
logger.ok(`Got ${exports.length} exports, ${stacks.length} active stacks`);
|
|
33
|
-
|
|
34
|
-
const projectDir = resolveProjectDir();
|
|
35
|
-
const catalogDir = join(projectDir, CATALOG_DIR_REL);
|
|
36
|
-
const projectCfg = loadProjectConfig({ projectDir });
|
|
37
|
-
const catalogMd = renderCatalog(groupExports(exports), { ...meta, total: exports.length });
|
|
38
|
-
const classified = classifyStacks(stacks, new Date(), projectCfg.legacy_prefixes);
|
|
39
|
-
const inventoryMd = renderInventory(classified, meta);
|
|
40
|
-
|
|
41
|
-
await mkdir(catalogDir, { recursive: true });
|
|
42
|
-
await writeFile(join(catalogDir, 'outputs-catalog.md'), catalogMd);
|
|
43
|
-
await writeFile(join(catalogDir, 'stacks-inventory.md'), inventoryMd);
|
|
44
|
-
logger.ok(`${CATALOG_DIR_REL}/outputs-catalog.md (${exports.length} exports)`);
|
|
45
|
-
logger.ok(
|
|
46
|
-
`${CATALOG_DIR_REL}/stacks-inventory.md (legacy=${classified.legacy.length}, serverless=${classified.serverless.length}, active=${classified.active.length}, stale=${classified.stale.length})`,
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const workflowResult = ensureWorkflowInstalled({ repoRoot: REPO_ROOT, projectDir });
|
|
50
|
-
if (workflowResult.installed) {
|
|
51
|
-
logger.ok('.claude/workflows/audit-all-stacks.js installed — invoke it via `/workflows` or `/audit-all-stacks`');
|
|
52
|
-
}
|
|
53
|
-
}
|
|
18
|
+
await assertLicensed({ command: 'sync', client: resolveLicenseClient() });
|
|
19
|
+
const cfg = loadConfig(opts);
|
|
20
|
+
logger.step('clawform sync — refresh catalog + inventory');
|
|
21
|
+
logger.info(`Profile: ${cfg.AWS_PROFILE} Region: ${cfg.AWS_REGION}`);
|
|
22
|
+
const client = cfnClient(opts);
|
|
23
|
+
|
|
24
|
+
const meta = {
|
|
25
|
+
generatedAt: new Date().toISOString(),
|
|
26
|
+
account: cfg.ACCOUNT_DEV || '(unknown)',
|
|
27
|
+
region: cfg.AWS_REGION,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
logger.info('Fetching exports + stacks in parallel…');
|
|
31
|
+
const [exports, stacks] = await Promise.all([fetchExports(client), fetchStacks(client)]);
|
|
32
|
+
logger.ok(`Got ${exports.length} exports, ${stacks.length} active stacks`);
|
|
33
|
+
|
|
34
|
+
const projectDir = resolveProjectDir();
|
|
35
|
+
const catalogDir = join(projectDir, CATALOG_DIR_REL);
|
|
36
|
+
const projectCfg = loadProjectConfig({ projectDir });
|
|
37
|
+
const catalogMd = renderCatalog(groupExports(exports), { ...meta, total: exports.length });
|
|
38
|
+
const classified = classifyStacks(stacks, new Date(), projectCfg.legacy_prefixes);
|
|
39
|
+
const inventoryMd = renderInventory(classified, meta);
|
|
40
|
+
|
|
41
|
+
await mkdir(catalogDir, { recursive: true });
|
|
42
|
+
await writeFile(join(catalogDir, 'outputs-catalog.md'), catalogMd);
|
|
43
|
+
await writeFile(join(catalogDir, 'stacks-inventory.md'), inventoryMd);
|
|
44
|
+
logger.ok(`${CATALOG_DIR_REL}/outputs-catalog.md (${exports.length} exports)`);
|
|
45
|
+
logger.ok(
|
|
46
|
+
`${CATALOG_DIR_REL}/stacks-inventory.md (legacy=${classified.legacy.length}, serverless=${classified.serverless.length}, active=${classified.active.length}, stale=${classified.stale.length})`,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const workflowResult = ensureWorkflowInstalled({ repoRoot: REPO_ROOT, projectDir });
|
|
50
|
+
if (workflowResult.installed) {
|
|
51
|
+
logger.ok('.claude/workflows/audit-all-stacks.js installed — invoke it via `/workflows` or `/audit-all-stacks`');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// clawform update — pull the newest plugin content in one command after a CLI
|
|
2
|
+
// upgrade. Thin on purpose: it force-refreshes the plugin kit (the fix for a
|
|
3
|
+
// frozen `~/.clawform/kit.bin`) via `init plugin --refresh`, then reminds you to
|
|
4
|
+
// bump the npm binary — which a running process cannot replace on its own.
|
|
5
|
+
//
|
|
6
|
+
// NOT license-gated in itself: it never calls assertLicensed, so a user
|
|
7
|
+
// mid-recovery is not blocked by a SECOND gate here. It delegates the one
|
|
8
|
+
// licence-checked step to `init plugin`, which already gates the kit fetch and,
|
|
9
|
+
// on a stale record, points at `clawform activate` (which re-adopts the existing
|
|
10
|
+
// slot for free — see activate.js). The kit is served independently of the CLI
|
|
11
|
+
// version, so this refreshes skills even before the npm binary is bumped.
|
|
12
|
+
|
|
13
|
+
import { logger } from '../lib/logger.js';
|
|
14
|
+
import initPlugin from './init-plugin.js';
|
|
15
|
+
|
|
16
|
+
export default async function update({ scope = 'global' } = {}, {
|
|
17
|
+
runInitPlugin = initPlugin,
|
|
18
|
+
} = {}) {
|
|
19
|
+
logger.step('clawform update');
|
|
20
|
+
await runInitPlugin({ scope, refresh: true });
|
|
21
|
+
logger.info('');
|
|
22
|
+
logger.info('For the newest CLI itself (new commands/flags), also run:');
|
|
23
|
+
logger.info(' npm i -g @thejoseki/clawform@latest');
|
|
24
|
+
}
|